Secure Login
VBA

We offer code samples to make it easy for you to plug in SMS functionality into your applications.

Download our SDK containing sample projects in many languages or go straight to the language you need with our code samples.

Sub test()
    Dim xmlstring As String

    Username = "user@mailaddress.com"
    Password = "yourpass"
    Message = "Your Message Here"
    Destination = "447777777777"
    xmlstring = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?> " & _
   "<Request xmlns:xsi=" & Chr(34) & "http://www.w3.org/2001/XMLSchema-instance" & Chr(34) & " xsi:noNamespaceSchemaLocation=" & Chr(34) & "http://schema.2sms.com/1.0/0410_RequestSendMessage.xsd" & Chr(34) & " Version = " & Chr(34) & "1.0" & Chr(34) & ">" & _
        "<Identification>" & _
            "<UserID><![CDATA[" & username & "]]></UserID>" & _
            "<Password>" & password & "</Password>" & _
        "</Identification>" & _
        "<Service>" & _
            "<ServiceName>SendMessage</ServiceName>" & _
            "<ServiceDetail>" & _
                "<SingleMessage>" & _
                    "<Destination>" & Destination & "</Destination>" & _
                    "<Text><![CDATA[" & Message & "]]></Text>" & _
                "</SingleMessage>" & _
            "</ServiceDetail>" & _
        "</Service>" & _
    "</Request>"

    Dim xmlrequest As MSXML2.XMLHTTP
    Set xmlrequest = New MSXML2.XMLHTTP
    xmlrequest.Open "post", "http://www.2sms.com/xml/xml.jsp", False
    xmlrequest.setRequestHeader "content-type", "text/xml"
    xmlrequest.send xmlString

    End Sub
©2sms Business Text Messaging,2018