Send SMS messages via XMLHTTP and VBA

Using web services we can send SMS text messages. WebserviceX.NET has an API for doing so.

The XMLHTTP object has methods for connecting to their web service that sends SMS text messages to various networks around the world. See the details for the SendSMS function for more information.

Note that I wasn't able to test either of these functions, so I'm not aware of the return value or how to parse it. If anyone out there is able to do so, please contact me.

Send SMS messages to selected networks

Function SendSMS(fromEmail As String, countryCode As String, _
                 mobileNumber As String, messageText As String)

' Important: drop leading zeros

Dim xml As Object
Dim result As String

  Set xml = CreateObject("MSXML2.XMLHTTP")

  xml.Open "GET", _
   "http://www.webservicex.net/sendsmsworld.asmx/sendSMS?FromEmailAddress=" & _
   fromEmail & "&CountryCode=" & countryCode & "&MobileNumber=" & mobileNumber _
   & "&Message=" & messageText, False
  xml.Send

  result = xml.responsetext

End Function

Send SMS messages to India only

Here is a related function that sends SMS messages to specific networks in India. See the webservicex.net page for details on which networks are covered.

Function SendSMSToIndia(fromEmail As String, mobileNumber As String, _
        messageText As String)
' See http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=21
' for full details

' Important: drop leading zeros

Dim xml As Object
Dim result As String

  Set xml = CreateObject("MSXML2.XMLHTTP")

  xml.Open "GET", _
"http://www.webservicex.net/SendSMS.asmx/SendSMSToIndia?MobileNumber=" _
& mobileNumber & "&FromEmailAddress=" & fromEmail & "&Message=" & messageText, False
  xml.Send

  result = xml.responsetext

End Function

Site last updated July 26, 2010 @ 8:14 pm