How to Receive an SMS Using Visual Basic

Written by brenda barron Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Receive an SMS Using Visual Basic
Receive an SMS text with Visual Basic. (girl typing a sms message image by Ramona smiers from

Sending and receiving texts is pretty simple on your phone. However, if you don't have your phone handy, you can program a simple application to receive SMS texts for you just using Visual Basic. Once you send messages, you'll be able to receive new ones back. Take your time when programming to make sure you get all of the commands correct. Otherwise, your program won't work.

Skill level:

Other People Are Reading


  1. 1

    Install SMSLibx, following the instructions with the install wizard. You can download SMSLibx online (see Resources).

  2. 2

    Start your copy of Visual Basic to load the application. Click on "Projects" from the main menu, then select "References." Locate "SMSLibx" in the reference list and highlight it. Click "OK."

  3. 3

    Make a Visual Basic declaration. This will be your SMS object. Once you have access to the declaration code editor, type the following:

    Public WithEvents Modem As SMSModem

  4. 4

    Input the following code just under the code you typed out in Step 3. This will be the function that sends your messages. Type out:

    Private Sub nowSendSMSMessage(PhoneNumber, MessageText)

    ' Open modem communication

    Set Modem = New SMSModem

    Modem.LogTrace = True

    Modem.OpenComm ModemType, ModemPort, , smsNotifyAll

    ' Send message

    Call Modem.SendTextMessage(PhoneNumber, MessageText)

    End Sub

  5. 5

    Input the following code just below the code added in Step 4. This will be the function to receive SMS messages. Type out:

    Private Sub nowRecieiveSMSMessage(Message As SMSLibX.SMSDeliver)

    MsgBox "New message received from " & Message.Originator & ":" _

    & vbCrLf & vbCrLf & Message.Body, _

    vbInformation, "New message received"

    End Sub

  6. 6

    Click on "Project," then select "Save" from the menu bar to save your document. With the "Save" window open, locate the "Documents" directory, name the file "Messenger.vbscript" and click "Save."

  7. 7

    Click the Windows "Start" menu in the lower left of your desktop, type "CMD.exe" and press "Enter" to open the Command Prompt in Windows Vista and later. In Windows XP and earlier, click "Start," click "Run," type "CMD.exe" and press "Enter."

  8. 8

    Type the following in the Command Prompt, then press "Enter" to send a message:

    c:\Documents\Messenger.vbscript nowSendSMSMessage('the phone number', 'input the message you want to send here')

  9. 9

    Receive messages by inputting the following text into the Command Prompt and pressing "Enter":

    c:\Documents\Messenger.vbscript nowReceiveSMSMessage()

    This will let your computer wait for messages to come in.

  10. 10

    Repeat Steps 8 and 9 to have a conversation.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.