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

New to VB and Pro/E - Summary


New to VB and Pro/E - Summary

I've been asked for a summary and also got a request for the manual.

The manual is the User Guide, and it's installed (WF4, remember) automatically at:

There's also an online version that is mentioned in the UG and it's located at:


The online browser is more complete, in that is references every method and object, etc.

As for a summary, I guess the best I can do is include the program I used. It's in the attached text file. The code is pretty simple and could be further simplified, but works for now. There is little exception handling, so beware...

Here's how it works.

After launching, a dialog with 3 text entry boxes and 2 buttons is shown.

One button allows you to connect to a running Pro/E session and will change text once connected. A status text at the bottom tells you what model you've connected to.

In order for my program to work, your model should have 3 parameters, named "COMPRIMENTO", "LARGURA" and "ALTURA" (L,W,H).

These should be related to the 3 dimensions of a prismatic part, so when the parameter changes, the size does too.

The current values get read in when you CONNECT to the model. Edit the values you want and press ACTUALIZAR (update) and your model should regenerate at the new values. You may need to click on the Pro/E window to update the graphics.

And that's my first VBA program for Pro/E, hope it helps someone. I'm off to make things worse for myself by mixing in some arrays, etc 🙂


Rui Vaz wrote:Ok, never mind, I figured it out.

I made a small function to update the parameters using

(New CMpfcModelItem).CreateDoubleParamValue(CType(valor, Double)

Thanks anyway.


Rui Vaz wrote:Ok update to this.

Got a handy reference to the manual from Jon Sprang(thanks) but now I'm
stuck (again).

Situation: I've managed to read parameters and their values from the
model to the application.

Now I need to send a value back to a parameter. Any tips on how to do that?

I have the model identified, I have the session connected, I have the
parameter and I have the variable. How do I get the variable's value to
the model's parameter?

Thanks for any clues, the more detailed the better.



Rui Vaz wrote:
Hi everyone

Though my experience with VBA for Excel has allowed me to do what I've
needed so far, VB for Pro/E needs a push.

I'm starting simple: a dialog with 3 text fields to change Length,
Width and Height (comprimento, largura, altura in Portuguese) of a
prismatic part.

On the dialog side, I've managed to get 3 variables converted to
Double from the text boxes.

Now I need to get those values to the corresponding parameters in the
Pro/E model.

I (think I) need to "get the session" then "get the current model" in
order to "get the respective parameters" and change them.

Can anyone help with the "getting the session" and "getting the
current model" parts to get me back on track?

I am using Visual Studio 2008 Express if that makes a difference.

The VB text I used is in the attached text file.

Thanks in advance.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Attention: Creo 7.0 Customers
Please consider upgrading
End of Life announcement here.

NEW Creo+ Topics:
PTC Control Center
Creo+ Portal
Real-time Collaboration