展开全部
Private Sub ComSend1_Click()
Dim fs As Variant
Dim a As String Dim i As Long
Dim filepath As String Dim m
filepath = App.Path & "\abc.txt" '文本文档名称为 123.txt
Open filepath For Input As #1
Line Input #1, a
Close #1
m = Split(a, ",")
If UBound(m) = 0 Then
Exit Sub '如果发送数据为空则退出过程
ElseIf MSComm1.PortOpen = False Then
MsgBox "串口未打开!", 64, "提示"
Exit Sub
End If
MSComm1.Settings = com_setting fs = Replace(TextSend.Text, " ", "")
For i = LBound(m) To UBound(m)
fs = CStr(Abs(m(i)))
MSComm1.Output = fs
Label11.Caption = Len(strsend) '发送计数
Next i
Close #1
End Sub
Dim fs As Variant
Dim a As String Dim i As Long
Dim filepath As String Dim m
filepath = App.Path & "\abc.txt" '文本文档名称为 123.txt
Open filepath For Input As #1
Line Input #1, a
Close #1
m = Split(a, ",")
If UBound(m) = 0 Then
Exit Sub '如果发送数据为空则退出过程
ElseIf MSComm1.PortOpen = False Then
MsgBox "串口未打开!", 64, "提示"
Exit Sub
End If
MSComm1.Settings = com_setting fs = Replace(TextSend.Text, " ", "")
For i = LBound(m) To UBound(m)
fs = CStr(Abs(m(i)))
MSComm1.Output = fs
Label11.Caption = Len(strsend) '发送计数
Next i
Close #1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询