VBA里调MSComm
'开始发送
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
For i = 0 To List1.ListCount - 1
For mc = 1 To haoMany
Temp = Trim$(List1.List(i))
If InStr(Temp, " ") > 0 Then Temp = Left(Temp, InStr(Temp, " ") - 1)
If Temp1 = "" Then Temp1 = " " Else Temp1 = ""
If (i <> 0 Or mc <> 1) Then Call Delay(20000)
PhoneNumber = Temp '取每个电话号码
For T = 1 To 12
PhoneN(T) = Mid(PhoneNumber, T, 1)
Next
PhoneN13 = Mid(PhoneNumber, 13, 1)
For T = 1 To 6
tmp = PhoneN(T * 2)
PhoneN(T * 2) = PhoneN(T * 2 - 1)
PhoneN(T * 2 - 1) = tmp
Next
UniPhoneN = ""
For T = 1 To 12
UniPhoneN = UniPhoneN + Hex(PhoneN(T))
Next
result = "0891" + UniSmsc + "F" + Smsc13 + "11000D91" + UniPhoneN + "F" + PhoneN13 + "000800" + UniLen(mc) + UniMessageCount(mc) 'PDU串
MSComm1.Output = "AT+CMGF=0" + vbCr
MSComm1.Output = "AT+CMGS=" & Str(15 + Length(mc)) + vbCr
MSComm1.Output = result & Chr$(26)
Next
' If InStr(Ret, "-1") > 0 Then J = J + 1
' Text10 = Text10 + "状态:" + Ret + " 手号:" + List1.List(i) + Chr$(13) + Chr$(10)
Label9.Caption = "发送 " + CStr(i + 1) + "条 失败:" + CStr(J) + "条"""
Next i
MSComm1.PortOpen = False '结束发送
代码如上
VBA调用超级终端控制GSM MODEL发送短信,设备没有插入串口时,多次执行代码3.4次后就内存溢出,本人VBA菜,求大侠给看看 VBA?MSCOMM?GSM
[解决办法]
你的OutputSize是多少?