Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
With MSComm1
.CommPort = 7 'Port disesuaikan terhadap modem Wavecom yang terdeteksi
.Settings = "115200,n,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True
End With
MSComm1.Output = "AT+CMGS=" & Chr(34) & TxtNumber.Text & Chr(34) & vbCrLf
Sleep 1000
MSComm1.Output = TxtMessage.Text & Chr(26)
End Sub
Caranya:
- Buatlah 2 TextBox masing-masing diberi nama TxtNumber dan TxtMessage
- Tambahkan OCX Microsoft Comm Control 6.0 (MSComm)
- Tambahkan satu CommandButton dengan nama default.