Skip to main content
15-Moonstone
March 16, 2020
Solved

Can't find VBA reference

  • March 16, 2020
  • 2 replies
  • 10480 views

Hi. I've installed Creo 6, and I made sure to check all the Toolkit boxes, including the VBA API. I have declared the system variable and registered the server, as shown in the VB User Guide. but when I try to select the Creo VBA library as a reference in Excel, it's not there. Anyone know what step I'm missing?

Best answer by Pettersson

I finally got it to work! The final piece of the puzzle was that I needed to run the vb_api_register.bat AS AN ADMINISTRATOR. Just running it produced no warnings, but running it as an administrator it took a few seconds for it to run. Now I managed to get the sample script to work. Hooray!

 

Now I'm not sure if I even needed to do any of the other things. Perhaps the library would have appeared directly without needing the registry files from Martin had I done this from the beginning?

 

Anyway, thanks for your help, and here's hoping this thread helps someone else struggling with getting this stuff to work.

2 replies

24-Ruby III
March 16, 2020

Hi,

 

as you can see in https://community.ptc.com/t5/Customization/vb-file-called-trough-a-mapkey-fails/m-p/650241#M9292 discussion a couple of weeks ago I was able to use VBAPI.

See vbapi_example.docx document.

15-Moonstone
March 16, 2020

Thanks, Martin, that's pretty much exactly the procedure I'm trying to follow. The problem is that the Creo VB API library doesn't show up in my list of References (the screenshot on page 2). It's not in the list. I'm sure I've installed the VB API when I installed Creo (6). I even uninstalled and reinstalled just to make sure. I've also declared the system variable and I've run the BAT file to register the server.

 

EDIT: I could try it with Creo 5. Will try reinstalling that and see if it will get me the library.

15-Moonstone
March 16, 2020

I just uninstalled and reinstalled Creo 5, making sure to check every checkbox there was to check in the install. Still can't find the reference library.

Pettersson15-MoonstoneAuthorAnswer
15-Moonstone
March 17, 2020

I finally got it to work! The final piece of the puzzle was that I needed to run the vb_api_register.bat AS AN ADMINISTRATOR. Just running it produced no warnings, but running it as an administrator it took a few seconds for it to run. Now I managed to get the sample script to work. Hooray!

 

Now I'm not sure if I even needed to do any of the other things. Perhaps the library would have appeared directly without needing the registry files from Martin had I done this from the beginning?

 

Anyway, thanks for your help, and here's hoping this thread helps someone else struggling with getting this stuff to work.

24-Ruby III
March 18, 2020

@Pettersson wrote:

I finally got it to work! The final piece of the puzzle was that I needed to run the vb_api_register.bat AS AN ADMINISTRATOR. Just running it produced no warnings, but running it as an administrator it took a few seconds for it to run. Now I managed to get the sample script to work. Hooray!

 

Now I'm not sure if I even needed to do any of the other things. Perhaps the library would have appeared directly without needing the registry files from Martin had I done this from the beginning?

 

Anyway, thanks for your help, and here's hoping this thread helps someone else struggling with getting this stuff to work.


Hi,

 

1.] "I needed to run the vb_api_register.bat AS AN ADMINISTRATOR"

NOTE: In my vbapi_example.docx document, you can find following lines:

 

 

open Command Prompt window as Administrator
cd C:\PTC\Creo5_050\Creo 5.0.5.0\Parametric\bin
run vb_api_register.bat

 

 

This way vb_api_register.bat is launched AS AN ADMINISTRATOR

NOTE: I prefer launching bat-files from Command Prompt window - this procedure provides better chance to see warnings/errors.

 

2.] To check whether my reg-files are needed you can run vb_api_unregister.bat and then vb_api_register.bat.

 

3.] The biggest problem with getting the VB API up and running is the fact that the user has no idea that nmsd.exe in Creo 5.0.5.0 is faulty and must be replaced with older nmsd.exe (eg. from Creo 5.0.5.0). The same problem is present in Creo 6.0.4.0.

NOTE: PTC simply ignores the problem.