Programming Tutorials

Send SMS using VB code

By: Emiley J in Tutorials on 2009-03-16  

If you are looking for a simple program to send SMS from your PC using VB then here is the code.

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Load()
'Change this with the Baud rate of your modem (The one you use with Hyper Terminal)
' Change this with the port your Modem is attached 

End Sub

Private Sub Command1_Click()
'This line can be removed if your modem will always be in Text Mode...
MSComm1.Output = "AT+CMGF=1" & vbCrLf                          
Sleep 500
'Replace this with your mobile Phone's No.
MSComm1.Output = "AT+CMGS=+91232538538" & vbCrLf       
Sleep 1000
MSComm1.Output = "Hello This is my test message"
Sleep 2000
If InStr(MSComm1.Input, "OK") Then
    MsgBox "Message Send"
    MsgBox "Message Not Send"
End If

End Sub

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in )

Latest Articles (in