Results 1 to 6 of 6

sending sms from excel vba

Threaded View

  1. #1
    Registered User
    Join Date
    10-01-2020
    Location
    cameroun
    MS-Off Ver
    office 2007
    Posts
    37

    sending sms from excel vba

    I have a working excel vba program, which allows to invoice the services and to take the appointments of the customers. I would like that each time an invoice is issued, the customer receives a thank you message for the amount of the invoice by sms. Also when a client's appointment is recorded, he gets an acknowledgment of receipt.

    A similar problem has already been dealt with here. However there are items below that I did not understand in this code.

    My knowledge of vba is really basic. Can you help me please.

    Below is the code, as well as the lines which I don't understand.
    thank you in advance



    THE CODE

    Sub send_SMS(xyz As Integer)
    
        Application.ScreenUpdating = False
    '   Declaring varibles for sending sms
    
        Dim HttpReq  As New WinHttpRequest
        Dim response As String
        Dim sURL As String
        Dim smsto, smstext As String
    '   Declaring varibles for Application
    
        Dim lastrow, lastrow1, lastrow2, x, pointe As Long
        lastrow = Sheets(1).Range("A" & Rows.Count).End(xlUp).Row
        lastrow1 = Sheets(2).Range("A" & Rows.Count).End(xlUp).Row
        lastrow2 = Sheets(3).Range("A" & Rows.Count).End(xlUp).Row
    
    '   Caculation of red card points
    
        If xyz = 1 Then
            pointe = (frmmain.txtpointe.Value - frmmain.txtpointr.Value) + (frmmain.txtamount.Value 10 / 100)
            smstext = "Dear Member, You have reedemed " & frmmain.txtpointr.Text & " red points and your balance is " & pointe & " points"
        Else
            pointe = frmmain.txtpointe.Value + (frmmain.txtamount.Value * 10 / 100)
            If pointe >= 1000 Then
    
                smstext = "Dear Member, You have reached " & pointe & " red points and you can reedem it your next visit"
            Else
    
                smstext = "Dear Member, Your bill amount is " & frmmain.txtinvoice.Text & " and your Red Point balance is " & pointe & " Points"
            End If
        End If
    '  Checking for valid mobile number
    
        If Len(frmmain.lblmobile.Caption) < 10 Then
    
    
          Call nomobile(pointe)
    
        Else
            smsto = CStr(frmmain.lblmobile.Caption)
    
            ' //another way to create the HttpReq
            Set HttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    
            ' // API for sending sms
            sURL = "malert.in/api/api_http.php?username=username&password=password&senderid=REDHCP&to=" & smsto & "&text=" & smstext & "&route=Enterprise&type=text"
        '    Debug.Print sURL
            On Error Resume Next
    
            With HttpReq
            .Open "GET", sURL, False
            .send
            End With
    
            response = HttpReq.responseText
            HttpReq.waitForResponse
    '        MsgBox Left(response, 2)
            Debug.Print response
    
                If Left(response, 2) = "OK" Then
                    Call nomobile(pointe)
                Else
                   Call errorconnection(smstext, pointe)
                End If
        End If
        sURL = "malert.in/api/api_http_balance.php?username=username&password=password&route=Enterprise"
        '    Debug.Print sURL
            On Error Resume Next
    
            With HttpReq
            .Open "GET", sURL, False
            .send
            End With
    
            response = HttpReq.responseText
            HttpReq.waitForResponse
            frmmain.lblstatus.Caption = response
            Debug.Print response
            Application.ScreenUpdating = True
    End Sub



    The lines i dont understand

    (xyz As Integer)
    
    
    Dim lastrow, lastrow1, lastrow2, x, pointe As Long
        lastrow = Sheets(1).Range("A" & Rows.Count).End(xlUp).Row
        lastrow1 = Sheets(2).Range("A" & Rows.Count).End(xlUp).Row
        lastrow2 = Sheets(3).Range("A" & Rows.Count).End(xlUp).Row
    
    
    frmmain.txtpointe.Value + (frmmain.txtamount.Value
    Last edited by alansidman; 10-08-2020 at 05:58 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-08-2016, 09:57 AM
  2. sending sms from excel?
    By Johnny247 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2015, 10:10 PM
  3. Copying content of one excel to another excel and sending email with excel data
    By archies.gall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2012, 02:22 PM
  4. Something out of the Purview of Excel-Sending Excel table as a body in an Email?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2011, 07:50 AM
  5. [SOLVED] Sending SMS from Excel
    By Piotr in forum Excel General
    Replies: 1
    Last Post: 11-03-2005, 06:00 AM
  6. Sending fax from Excel
    By Bogdan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2005, 11:05 AM
  7. Replies: 0
    Last Post: 04-02-2005, 09:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1