Offered without comment because I didn't write it.
Code:Private Sub btnReceive_Click() txtReply.Text = MSComm1.Input End Sub Private Sub btnSend_Click() OutCom = txtCommand.Text MSComm1.Output = OutCom + vbCr End Sub Private Sub UserForm_Initialize() On Error GoTo 10 MSComm1.InBufferSize = 16384 MSComm1.InputMode = comInputModeText MSComm1.OutBufferSize = 16384 MSComm1.CommPort = 1 MSComm1.PortOpen = True MSComm1.Settings = "9600,N,8,1" 10: lblMessage.Caption = Error End Sub
Would you be able to provide the link where you found this code from. I want to confirm some bit as I had errors in my code I managed to fix them but just to see.
Errors were:
comInputModeText needs to comInputMode.Text, then add a textbox with name omInputMode to the form
MSComm1 needs to be declared as an object
lblMessage.Caption = Error Wasn't sure how to fix but I assume this is let the user know something went wrong. So I changed this to MessageBox.show("Error").
OutComm needs to be declared. I declared it as String