RetVal = MsgBox(ErrMsg, vbOKCancel, "Error transmitting file") 'ErrMsg = ErrMsg & ", Source = " & Err.Source If MSComm1.PortOpen = True Then MSComm1.PortOpen = FalseĮrrMsg = "An error occurred! " 'Error number = " & Err.Number If Range("A" & i) = Empty Then GoTo EndStatements If MSComm1.PortOpen = True Then GoTo ErrHandler ' Tell the control to read entire buffer when Input ' 9600 baud, no parity, 8 data, and 1 stop bit. MSComm1.CommPort = InputBox("Enter Methanol Pump (Comm Port) number",, 1) Here is some sample code with comments in CAPS However, I am hoping someone familiar with runtime errrors can help me figure out if I am on the right track in terms of the port issue or if the problem is in the layout of the code. Some of the code I'm not too familiar with exactly what it does since I inherited the backbone and only changed the loop parameters etc. The debugger goes to the errhandler line below and has an issue with " If MSComm1.PortOpen = True Then MSComm1.PortOpen = False". The laptop has a USB to RS-232 adaptor and I think the problem is that I need to change the Mscomm1 port to whatever port the USB adaptor is coming from on the laptop. I moved the program to a laptop and I got a run time error '424' object required. The current version I have works for a pc by taking the inputs from rows in the excel file and placing instructions in a certain order as steps in a process for the pump to perform. I am working with inherited code that I altered that takes input from Excel and serial port adaptor to automate peristalitc pumps.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |