Solution:
use
exist
mistake
biographical notes
Next, continue running if you encounter an error.
When you want to send data, or in some necessary cases, check.
It's Mscomm 1. PortOpen =True? If not, you can try to open the port once or pop up a prompt dialog box.
For example:
exist
mistake
biographical notes
then
if
Mscomm 1。 Port open
=
wrong
then
MSComm 1。 PortOpen=True
if
MSComm 1。 Port open
=
wrong
then
dialog box
"COM 1 failed to open!"
end
if
It is troublesome to check the port before each operation, but it is very effective.