0

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

braX
  • 11,506
  • 5
  • 20
  • 33
  • The error means `NETComm1` is Nothing, in other words the object could not be created and you're trying to access a property of something that doesn't exist. – Kostas K. Jul 08 '20 at 10:52
  • Did you register the OCX files? https://support.microsoft.com/en-us/help/146219/how-to-register-an-activex-control-ocx-manually – braX Jul 08 '20 at 11:53
  • Thank you both for your answers. @KostasK, I understood that but after all I tried, it still does not exist wheras it should ... @braX That is something I tried but I can only unregister the file. It seems like I can not register it back ... When I am using the command : ``` Regsvr32 /i C:\Windows\System\NETComm.ocx ```, I got the following error : "The module ... was loaded but the entry-point Dll was not found." When I use a dll explorer there is a function named DllRegisterServer. Do you know a solution to this issue ? – Titouan Cazala Jul 09 '20 at 09:14

1 Answers1

0

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

TarJae
  • 72,363
  • 6
  • 19
  • 66
Bese
  • 16