Welcome

Pass Parameters To SOLIDWORKS VBA Macro

Edit ArticleEdit Article

SOLIDWORKS VBA macros do not accept custom parameters as an input so it is not possible to pass user argument to ISldWorks::RunMacro2 method. This limitation could be the major 'roadblock' for performing the automation of SOLIDWORKS using API.

This could be a handy feature in cases where the macro is used as the part of bigger automation where multiple macros need to share the same argument (e.g. output location, time stamp, etc.). Or process is started from the server application or via scheduling software which generates the input which needs to be passed to the macro.

This section contains the implementation of alternative workarounds to overcome this limitation.

Several options of passing parameters to SOLIDWORKS VBA macros are explored and examples are provided.

Notifications

Join session by SOLIDWORKS and PDM API expret Artem Taturevych at 3DEXPERIENCE World 2025 on Feb 26 at 08:30 AM CST to explore 10 essential macros for automating drawings, assemblies, custom properties, and more


Product of Xarial Product of Xarial