VBA

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

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

Code Sample

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
    Set xmlrequest = CreateObject(“MSXML2.XMLHTTP.6.0”)

    xmlrequest.Open “post”, “https://www.2sms.com/xml/xml.jsp”, False
    xmlrequest.setRequestHeader “content-type”, “text/xml”
    xmlrequest.send xmlString
End Sub

Other Code Samples

Perl

We offer code samples to make it easy for you…
Read More

VBA

We offer code samples to make it easy for you…
Read More

PHP

We offer code samples to make it easy for you…
Read More

C#

We offer code samples to make it easy for you…
Read More
Scroll to Top