- The file path to the macro is correct and accessible by MATLAB.
- The macro file name, module name, and procedure name are all correct.
- The SolidWorks application has permissions to execute macros (consider security settings).
- Another alternative is to use "run" method.
How to run solidworks vba macros from matlab?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to run a VBA macro from a .m file. I've been able to successfully get Solidworks to start and open a part using:
swApp=actxserver('SLDWORKS.application')
set(swApp, 'Visible', true);
O1 =invoke(swApp,'OpenDoc','[file location]',1);
However, when trying to run a macro using the code below, the macro doesn't seem to run. No error is returned, but the macro hasn't run.
S1=invoke(swApp ,'RunAttachedMacro','Macro2.swp', 'Macro21', 'main')
Is there a problem in the way I'm calling the macro from matlab?
Thanks!
0 comentarios
Respuestas (1)
Pratyush
el 18 de En. de 2024
Hi Anish,
You're using "invoke" to call methods on the SolidWorks application object. The usage of "invoke" seems correct, but there might be an issue with the parameters you're passing to the "RunAttachedMacro" method.
Ensure the following:
Hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Data Export to MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!