I'm not sure how the .CommPort could change between the IF statement
and the assignment statement. In addition, when it fails, I can hover
over the variable and it tells me that the port is open (in the first
case) or closed (2nd case), so the assignment statement should work,
but still fails.
If my memory is correct, I have even set the program back to the IF
statement and reexecuted the lines and it still passes the IF
statement but still fails the assignment statement.
"CajunCoiler \(http://www.cajuncoiler.tk\)" <ca*********@totallyspamless.cox.net> wrote in message news:<V8fPa.553$N%3.372@lakeread01>...
Have you checked to assure that the .CommPort value hasn't
been accidentally changed? If it has, you're closing the
wrong port. :)
"Bill" <wi*****@hotmail.com> wrote in message
news:ee**************************@posting.google.c om... the following code works most of the time, but sometimes it fails.
Anyone got an idea? It will pass the IF statement (port is open) but
fail to set the port closed.
If MSComm1.PortOpen Then
MSComm1.PortOpen = False
End If
It also fails in the other direction.
If Not MSComm1.PortOpen Then
MSComm1.PortOpen = True
End If