» SMS from Access | » SMS from C# .NET | » SMS from Visual Basic (VB6) |
» SMS from Excel | » SMS from ASP .NET | » SMS from Visual C++ |
This tutorial illustrates how to send and receive SMS from a Microsoft Excel worksheet using the SMSLibX ActiveX component (DLL library).
The tutorial shows how to:
The reference environment is Microsoft Excel 2000.
A minimal expertise on VBA programming (Visual Basic for Applications) is required.
Now you're ready to use SMSLibX objects and methods directly in your source code.
The following VBA source code might be used into an Excel worksheet module, in order to send and receive SMS messages. With few modifications this code can be inserted in a VBA class module too.
The WithEvents
clause is essential in order to catch events raised by the SMSModem object.
' Declare SMSModem object Public WithEvents Modem As SMSModem ' Send SMS Private Sub cmdSendMessage_Click() ' Open modem communication Set Modem = New SMSModem Modem.LogTrace = True Modem.OpenComm ModemType, ModemPort, , smsNotifyAll ' Send message Call Modem.SendTextMessage(PhoneNumber, MessageText) End Sub ' Receive SMS by event Private Sub Modem_MessageReceived(Message As SMSLibX.SMSDeliver) MsgBox "New message received from " & Message.Originator & ":" _ & vbCrLf & vbCrLf & Message.Body, _ vbInformation, "New message received" End Sub
For a brief introduction on SMSLibX usage we recommend the Quick start section from SMSLibX Help.
SMSLibX is fully integrated into the Microsoft VBA development environment:
The following Excel worksheets provided with VBA source code are available for download:
Both examples are pre-configured for simulation mode (they do not send real SMS).
Once you got them working on yoir PC, you can configure them in order to use your actual GSM modem/phone by opening the worksheet source code (Tools > Macro > Visual Basic Editor menu) and modifying the 'TO DO' items.
If you experience some troubles, please refer to the "Troubleshooting" section.
Please read these notes carefully – they are very important for a good SMSLibX programming practice!
If your VBA application makes use of MsgBox and InputBox, please
note that VBA suppresses events from timers, forms, controls and ActiveX
components while one of these dialogs is open.
Events are not simply delayed but definitively suppressed (please see
Microsoft Knowledge Base 76557 article).
Due to this disagreeable behaviour, if a MsgBox is open your application may loose events notifying received messages - and any other event generated by SMSLibX.
As work-around, we suggest redefining the VBA MsgBox function and replacing it with the MessageBox
API from Windows (which does not suppress events: please see Microsoft Knowledge Base 76557 article
for details).
A concrete MsgBox re-definition example is available in the example source code
distributed with this tutorial.
If your VBA application cycles over a list of SMS messages to be sent - or
performs some other time-consuming operations - then you should provide a DoEvents
statement in your loop (or time-consuming operaton).
This will permit SMSLibX to continue raising its events in real-time (such as received messages, delivery reports and modem status events).
Moreover, your SMSLibX event listeners (the code you write inside an event procedure) should never contain time-consuming operations, since SMSLibX relies on the event calling thread for further message capture and notification.
When opening the examples you might experience some troubles due to missing SMSLibX registration on your system.
Should the following errors appear:
please restore SMSLibX references as explained in the first part of this tutorial.
Please refer to the Troubleshooting section of SMSLibX Help.
Mar 18, 2013 - Given the numerous requests, we've made available a last stock of this item (discontinued in 2010). Contact us if interested.
Mar 15, 2013 - Digicom Wave GPRS is now replaced by Digicom Wave GPRS M.
Mar 15, 2013 - Audiotel Modex GPRS modem (dismissed in 2011) is now exhausted. Can be replaced with Audiotel Modex EDGE or Digicom Wave GPRS M.
Jan 12, 2011 - Siemens TC35i and MC35i modems are now replaced by the successor Cinterion MC55i.
Jan 12, 2011 - Audiotel Industrial modem is now replaced by the successor Urmet Industrial.
May 19, 2010 - SMSLibX 2.6 and SMSList 2.14 releases are ready for download.
- Working teams
Contact your customers and mobile co-workers by SMS.
- Mobile marketing
Contact your audience with friendly SMS communication.
- Services and associations
Contact service subscribers and associates by SMS.
- Commercial consultants
Remind fiscal deadlines to your customers with an SMS.
- Medical offices
Send appointment reminders to your patients by SMS.
- Schools
Keep in contact with parents and students by SMS.
Learn how to send SMS and receive SMS with SMSLibX:
Different ways to send and receive SMS messages:
Create a message list and send it to multiple recipients with SMSList.
Integrate SMSLibX ActiveX into your web pages (ASP or other server-side technologies) to send and receive SMS from your site.
With SMSLibX you can add SMS sending and receival capabilities to Excel worksheets and Access databases.