mobcomm.RThreshold = 1
mobcomm.CommPort = 1
mobcomm.InputLen = 0 
mobcomm.PortOpen = TruePrivate Sub Command1_Click()
Sendsms "13800739500", phonecode.Text, msg.Text 
End SubPublic Function Sendsms(csca As String, num As String, msg As String) As Boolean
     Dim pdu, psmsc, pnum, pmsg As String
     Dim leng As String
     Dim length As Integer     length = Len(msg)
     length = 2 * length
     leng = Hex(length)
     If length < 16 Then leng = "0" & leng
     psmsc = Trim(telc(csca))
     pnum = Trim(telc(num))
     pmsg = Trim(ascg(msg))
     pdu = prex & psmsc & midx & pnum & sufx & leng & pmsg    Sleep (100)
     mobcomm.Output = "AT+CMGF=0" + vbCr
     Sleep (200)
     mobcomm.Output = "AT+CMGS=" & Str(15 + length) + vbCr
     Sleep (200)
    mobcomm.Output = pdu & Chr$(26)
    'Sleep (500)
     Sendsms = True
     MsgBox "ok"
    End Function