Using mapkeys in VB api
Hi all,
Is it possible to control a mapkey (like modelcheck and checkin) by VB api. My idea is to make a buttom in excel that executes the mapkeys. In the VB user guide from PTC there is an example but I can't figure it out. If I follow the instructions I get an error. VB doesn't recognize the @ and ~
This is the part out of the VB user guide
Method Introduced:
IpfcBaseSession.RunMacro()
The method pfcSession.BaseSession.RunMacro runs a macro string. A VB API macro string is equivalent to a
Creo Parametric mapkey minus the key sequence and the mapkey name. To generate a macro string, create a
mapkey in Creo Parametric. Refer to the Creo Parametric online help for more information about creating a
mapkey.
Copy the Value of the generated mapkey Option from the Tools Options dialog box. An example Value is as
follows:
$F2 @MAPKEY_LABELtest;
~ Activate `main_dlg_cur` `ProCmdModelNew.file`;
~ Activate `new` `OK`;
The key sequence is $F2. The mapkey name is @MAPKEY_LABELtest. The remainder of the string following the
first semicolon is the macro string that should be passed to the method pfcSession.BaseSession.RunMacro.
In this case, it is as follows:
~ Activate `main_dlg_cur` `ProCmdModelNew.file`;
~ Activate `new` `OK`;
Note
Creating or editing the macro string manually is not supported as the mapkeys are not a supported scripting
language. The syntax is not defined for users and is not guaranteed to remain constant across different
datecodes of Creo Parametric.
Macros are executed from synchronous mode only when control returns to Creo Parametric from the VB API
program. Macros are stored in reverse order (last in, first out).
Macros are executed as soon as they are registered. Macros are run in the same order that they are saved.
Looking forward for a reply 🙂

