excelvbaruntime-errorusb-driveusbserial

VBA NETComm issues


I am working on a VBA GUI that I have not developped by myself. I do not really know VBA langage and I need help.

I am trying to drive an electronique card plugged as USB with that GUI. The problem is that I am trying to use NETComm.ocx to send instruction to the device but I have an issue that is knowed by the GUI developper and voluntary ignored because he does not have the issue. It seems to depend of the computer.

I am adding NETComm.ocx and MSComm32.ocx files to the path where Excel VBA is looking for them. When I check in the References panel, it seems to work well but when I am executing the code, I have a

"Run-time error '424' : object required.

When I clic "Debug" it highlight the following line :

NETComm1.CommPort = VirtualCommPortNumber

VirtualCommPortNumber is an integer. It seems like it does not know NETComm but I do not know how to do to fix that.

Thanks for your help.

Titouan


Solution

  • You need to Copy NETComm.ocx and MSCOMM32.OCX to C:\Windows\System I think the Paths are hard-coded in these files, so they can be only registered from here.

    Run cmd as administrator and

    Type regsvr32 C:\Windows\System\NETComm.ocx and ENTER

    Type regsvr32 C:\Windows\System\MSCOMM32.OCX and ENTER

    Resource: https://info.kmtronic.com/control-kmtronic-relays-via-excel.html