Comm32 Logo
Home Button   

Topic:   Invalid Port Number (8002)

By: Yosi KarlPosted on: Mar 2 2013 at 12:45:30 AM
Hello,
I am trying to use SComm32 from Excel 2007 on Windows 7 (64 bit).
(no issue with multiple licenses, as this project is only intended to run on my computer - if it eventually works).

I follow the pattern of the example:
* Created a form (UserForm1).
* Placed an SComm32 control on the form, called it SComm1
Running the following code:
UserForm1.SComm1.CommPort = 7
MsgBox("Port Name: " & UserForm1.SComm1.CommName)
UserForm1.SComm1.Settings = "9600,n,8,1"
UserForm1.SComm1.PortOpen = True
The Message Box correctly shows the user readable name of the port (""). This means that I set the correct CommPort.
However, when reaching the '.PortOpen = true' command, I receive a run time error 8002.

Anyone can help explain what the problem might be?

By: GuestPosted on: Mar 2 2013 at 11:15:42 PM
Did you read the documentation of the CommName property?

It returns and empty string "" if the port does NOT exist.

Look in device manager. What ports do you have?

By: Yosi KarlPosted on: Mar 3 2013 at 07:59:38 AM
Thank you, Guest, for your reply.
The message box DOES show the correct CommName ("USB Serial Port (COM7)") - I made a mistake in my previous post when I wrote an empty string.
The port is also listed correctly in device manager.

Any other ideas?