Question & Answer
Question
How do you run a VBA macro from the command line?
Answer
This can be done by using the -cmd=runvbamacro switch. Below is an excerpt from the COM API Reference Guide:
RUNVBAMACRO
Description:
Runs the specified VBA macro outside an active project. The VBA script must already exist within a Rhapsody model and be
compiled so the file .vba exists. You can copy a .vba file into your project directory (where the .rpy file is located). For example,
if you have the project file abc.rpy, copy your macro .vba file as abc.vba then use the runvbmacro switch to run the macro.
Note the following:
• In VBA, if you do not specify a module name, the default is module1.
• You cannot pass parameters to the module.
Command-Line Syntax
rhapsody -cmd=open -cmd=runvbamacro
Example:
rhapsody -cmd=open d:\rhapsody\models\hhs.rpy -cmd=runvbamacro module1 first
[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
Historical Number
10358
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21323661