M
Marty
I created a form and put the mscomm object on it. i am using this code and
it doesn't work. The mscomm1.input returns junk.
please help.
Private Sub CommandButton1_Click()
If UserForm1.MSComm1.PortOpen Then
MsgBox (UserForm1.MSComm1.PortOpen)
Exit Sub
End If
UserForm1.MSComm1.CommPort = 2
UserForm1.MSComm1.Settings = "9600,N,8,1"
UserForm1.MSComm1.InputLen = 0
UserForm1.MSComm1.InputMode = comInputModeText
UserForm1.MSComm1.RTSEnable = True
UserForm1.MSComm1.Handshaking = comRTSXOnXOff
UserForm1.MSComm1.RThreshold = 1
UserForm1.MSComm1.PortOpen = True
MsgBox (UserForm1.MSComm1.PortOpen)
UserForm1.Show
and the oncomm event on the control
Private Sub MSComm1_OnComm()
MsgBox ("Hello Marty1")
MsgBox UserForm1.MSComm1.Input
'Range("B9").Select
' ActiveCell.FormulaR1C1 = Left(MSComm1.Input, 10)
' Debug.Print MSComm1.Input
End Sub
it doesn't work. The mscomm1.input returns junk.
please help.
Private Sub CommandButton1_Click()
If UserForm1.MSComm1.PortOpen Then
MsgBox (UserForm1.MSComm1.PortOpen)
Exit Sub
End If
UserForm1.MSComm1.CommPort = 2
UserForm1.MSComm1.Settings = "9600,N,8,1"
UserForm1.MSComm1.InputLen = 0
UserForm1.MSComm1.InputMode = comInputModeText
UserForm1.MSComm1.RTSEnable = True
UserForm1.MSComm1.Handshaking = comRTSXOnXOff
UserForm1.MSComm1.RThreshold = 1
UserForm1.MSComm1.PortOpen = True
MsgBox (UserForm1.MSComm1.PortOpen)
UserForm1.Show
and the oncomm event on the control
Private Sub MSComm1_OnComm()
MsgBox ("Hello Marty1")
MsgBox UserForm1.MSComm1.Input
'Range("B9").Select
' ActiveCell.FormulaR1C1 = Left(MSComm1.Input, 10)
' Debug.Print MSComm1.Input
End Sub