cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't find VBA reference

SOLVED
Highlighted
Amethyst

Can't find VBA reference

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?

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Can't find VBA reference

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.

View solution in original post

21 REPLIES 21
Highlighted

Re: Can't find VBA reference

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.


Martin Hanák
Highlighted

Re: Can't find VBA reference

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.

Highlighted

Re: Can't find VBA reference

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.

Highlighted

Re: Can't find VBA reference


@Pettersson wrote:

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.


Hi,

if you tell me:

  • Excel version
  • Creo 6.0 version

then I can try installing this combination tomorrow.


Martin Hanák
Highlighted

Re: Can't find VBA reference

Hi, Martin. I really appreciate it. I use Office 365 ProPlus. Excel tells me it's version 1908 (Build 11929.20606 Click-to-Run). I downloaded the latest Creo 6 build from PTC: 6.0.4.0. I also tried the latest build of Creo 5.

 

Do you know the name of the file that contains the library? Is it a DLL file in the SYSTEM32 folder in Windows?

Highlighted

Re: Can't find VBA reference


@Pettersson wrote:

Hi, Martin. I really appreciate it. I use Office 365 ProPlus. Excel tells me it's version 1908 (Build 11929.20606 Click-to-Run). I downloaded the latest Creo 6 build from PTC: 6.0.4.0. I also tried the latest build of Creo 5.

 

Do you know the name of the file that contains the library? Is it a DLL file in the SYSTEM32 folder in Windows?


Hi,

 

1.] I do not have access to MS Office 365 at the moment. I would have to create a virtual machine and install a trial version of MS Office 365 into it. Unfortunately, it takes a lot of time, so I don't want to do it 🙂

 

2.] I guess that MS Office 365 is not supported. See following documents.

https://www.ptc.com/en/support/article/CS149998 

http://support.ptc.com/WCMS/files/160242/en/PTC_Creo_Future_Platform_Support_Summary.pdf 

 

3.] I tested Creo 5.0.5.0 with MS Excel 2016 successfully on my PC.

 

4.] I opened Registry Editor and ... I was looking for "Creo VB API Type Library".

I found 5 items ... see files inside attached zip file.

 


Martin Hanák
Highlighted

Re: Can't find VBA reference

Thanks for your help, Martin. I added those registry keys to my computer. That actually made the API pop up in my library list. Unfortunately it couldn't be loaded. I noticed the path listed was not my installation path, but at least I could see which file it was supposed to use (Common Files\x86e_win64\obj\pfclscom.exe). I tried browsing for that file, but nothing happened when I selected it. I then uninstalled Creo 5 and reinstalled it at the location indicated by your registry keys (C:\PTC\Creo5_050\). That actually let me check that box and load the library. I reset the environment variable and unregistered and reregistered the COM server. Now I can actually get a little bit ahead in my script. It looks like it recognizes some commands. However, it still fails to connect to Creo.

 

I looked in the User Guide and in "Troubleshooting" it tells me to make sure that nmsd.exe is running, which it isn't. Then I remembered you wrote something about that file in your document, that it's problematic and causes a failure to connect. You say to use a file from a 5.0.2.0 installation, but I don't have access to such a file. do you think you could upload it? I'm hoping that's the final problem for me to be able to connect. Many thanks for your help.

Highlighted

Re: Can't find VBA reference

Hi,

are you sure you cannot download Creo 5.0.2.0 from https://support.ptc.com/appserver/auth/it/esd/product.jsp?prodFamily=ENG page ?


Martin Hanák
Highlighted

Re: Can't find VBA reference

I suppose i can download that, install Creo 5.0.2.0, make a copy of the file, then reinstall 5.0.5.0. I'll give it a try.

Highlighted

Re: Can't find VBA reference


@Pettersson wrote:

I suppose i can download that, install Creo 5.0.2.0, make a copy of the file, then reinstall 5.0.5.0. I'll give it a try.


Hi,

you can have multiple Creo installations on your computer at the same time.

For example you can install:

  • Creo 5.0.5.0 into C:\PTC\Creo5_050
  • Creo 5.0.2.0 into C:\PTC\Creo5_020
  • Creo 6.0.4.0 into C:\PTC\Creo6_040
  • and so on ...

 

 

 


Martin Hanák
Highlighted

Re: Can't find VBA reference

Nope, still doesn't work. I think I'll give up. Thanks for your help, Martin. I've tried to set up Jlink, I've tried VB API, it's all very obscure and badly documented. You have to go in and edit files, set up environment variables, create startup sequences ... I really don't understand why this has to be so difficult. I might just have to give up on it all.

Highlighted

Re: Can't find VBA reference


@Pettersson wrote:

Nope, still doesn't work. I think I'll give up. Thanks for your help, Martin. I've tried to set up Jlink, I've tried VB API, it's all very obscure and badly documented. You have to go in and edit files, set up environment variables, create startup sequences ... I really don't understand why this has to be so difficult. I might just have to give up on it all.


Hi,

just one final comment.

1.] before copying nmsd.exe from Creo 5.0.2.0 to Creo 5.0.5.0, you have to kill running nmsd.exe process in Task Manager (on Details tab)

2.] nmsd.exe location is C:\PTC\Creo5_050\Creo 5.0.5.0\Common Files\x86e_win64\nms directory

3.] when you start Creo 5.0.5.0 you can look into Task Manager (Details tab) and check Description of running nmsd.exe process (if wrong version is running, you have to end Creo session, kill nmsd.exe process and start Creo again)

4.] YES developing is complicated

5.] maybe you can describe functionality you need to develop and somebody helps you to get it

 


Martin Hanák
Highlighted

Re: Can't find VBA reference

That was a good idea; I had restarted Creo but not manually killed nmsd.exe. I tried it now, unfortunately no luck. Still can't connect to the Creo session. I wasn't going to develop a specific application; rather I was hoping to learn how to work with Creo APIs to extend my knowledge and range in Creo. I'm a Creo teacher by profession and wanted to get into this functionality, but it seems I can't get anywhere. Our CATIA teacher recently wrote a blog post on how to control CATIA through Excel, and I was hoping I could write up a post saying you can do the same thing with Creo, but if I can't even get the API to work, I'll just have to give up and admit CATIA's superiority, hahaha.

Highlighted

Re: Can't find VBA reference

Excel is VERY Powerful these days.... connecting it to Creo (beyond the standard interfaces that PTC provides) is a bit tricky.   Being able to connect Creo to Excel opens up everything - connecting to other business systems, custom calculations, data comparisons, etc. etc. etc...

 

We wrote a (commercial) application specifically for this - it has been around like 15+ years -- Nitro-CELL and is getting new functionality all the time.  Neat things soon.

 

Nitro-CELL does not provide full access to the PTC APIs - but does use/require JLINK as the interface to perform operations in Creo .... so things like erasing memory, opening models, setting parameters / materials / etc, regenerations, export of geometry is straightforward using excel commands.

 

We just changed the syntax to leverage Excel capabilities - it is very easy to find and use the commands that you want to execute in Creo.  Here is an example : Nitro-CELL New Command Syntax 

 

Here are a few example videos of what you can do with it:  Nitro-CELL Use Case / Example Playlist 

 

CREOSON - is basically the SAME CORE API that Nitro-CELL Uses - but CREOSON is an API for remote automation execution (you can use any language you want - but Python + CREOPYSON Library seems to be the most popular.

 

The APIs we deliver (via CREOSON or Nitro-CELL) are HIGHLY optimized and simplified vs coding with the native PTC APIs.  So for example, we extensively support wildcarding of requests (so set a new Parameter value to ALL parts by using *.prt vs constructing a loop operation in code manually).

 

Our goals with both products - remove the barrier (coding) from the result as much as possible.  Focus on the data flow and state of things in Creo - all is good!

 

So.... go tell that fancy CATIA person .... ya got something better!

 

Hope that helps.

 

Dave

 

Highlighted

Re: Can't find VBA reference

Have you looked at CREOSON?

 

This may help you achieve some of your goals....  regarding automating Creo.  

 

Dave

 

Highlighted

Re: Can't find VBA reference

Thanks, David, yeah, I've looked at CREOSON and considered trying it out. It's a bit of a hassle, though, and I doubt it would be practical for my students to set that up at their companies. The advantage of using Excel is that pretty much everyone has it installed, and it can control just about any software through macros, out of the box. additionally, you have the whole power of Excel for processing data. Just Google up a piece of code, edit it to suit your needs, and presto! Doesn't seem that easy with Creo, though.

Highlighted

Re: Can't find VBA reference

OH BTW --

 

"It's a bit of a hassle, though, and I doubt it would be practical for my students to set that up at their companies."

 

Who do you think were the first to use CREOSON?    #companies (big ones) 🙂

 

As you have seen ... just having Excel and Creo does not mean it is going to be an easy journey to implement, deploy or maintain.   This is one of the main reasons we created Nitro-CELL -- focus on download, connect and get to work!

 

Dave

 

Highlighted

Re: Can't find VBA reference

@DavidBigelow , NITRO-CELL really seems like a powerful product and if I were working at a development company I'd love for them to buy it. I've seen some demos before (and I think i even participated in a meeting regarding implementing this when I was working at Ericsson). It's a decision to be taken at a higher level than individual users, though. And CREOSON does look spiffy, but it's another layer of abstraction. I need to learn JSON and I need to learn another programming language to generate the JSON requests. If I know (for example) VBA, it seems easier to use that to directly send commands to Creo. I might still take a look at it in the future, though for the moment I seem to have managed to get the VB API to work, so I'll play around with that first.

Highlighted

Re: Can't find VBA reference

Don't let the JSON freak you out...

 

JSON is just a neutral text-based data structure representation for what your language of choice is already doing for objects storage and manipulation.   It is also a very common standard for interfacing different systems for transactions and data sharing (locally or remote).   Getting away from "user" thinking to more of "systems" thinking.

 

You are right, technically speaking, there is another layer of abstraction...  Much like Excel is an abstraction over pencil and paper.  Simple things you don't need it for... but the more data, the more process, the more automation required... pencil and paper become a burden whereas Excel becomes trivial.

 

We have quite a few customers using CREOSON with VB and Excel.  VB is not the prettiest thing (double quote hell), terrible debugging environment and requires a bit of knowledge about VB to use it efficiently - add in PTC's APIs and trying to figure out what is needed for what types of data/operations -- it can be a bit of a journey.   CREOSON adds to that layer of course for the HTTP requests and transaction definition.  But once you get through those issues, everything is pretty quick to do.

 

Hope this helps / inspires.   nice find on the run as administrator!

 

Dave

 

 

 

 

 

 

 

Highlighted

Re: Can't find VBA reference

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.

View solution in original post

Re: Can't find VBA reference


@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.

 


Martin Hanák
Announcements