In Transition Action, you can use Excecute command instead of Exceute task to start a program to execute a VBA script.
In Enter command to excecute, enter e.g.: Excel.exe /e "c:\macro.xlsm"
Have a look here for more information about starting macros in Excel or batch file: https://stackoverflow.com/questions/2050505/way-to-run-excel-macros-from-command-line-or-batch-file
And here for an example of how to include PDM in Excel: https://forum.solidworks.com/thread/211801
Maybe something will be useful:
Thanks for the help Ulf. I've combined this with the help I got from Artem at my other post (PDM Add-In for Basic VBA-Type Functions/Tasks ). How I have it now is PDM is executing a command to start a VBScript which then calls an excel VBA script from a workbook. This seems to be working well.
Would there be a way to cutout the middle VBScript though? Can PDM directly call an Excel VBA script from within a module and pass it an argument? I know you can open a workbook which could then execute a script using the Workbook_Open event but I want to also pass it an argument (the filename moving through the transition).
In my opinion, the easiest way is to start Excel via batch file. In the batch file, you assign the required values to environment variables and read them in Excel.
Sub Workbook_Open ()
Application.Visible = False
MsgBox "param1:" & Environ ("param1")
"EXCEL.EXE" /e "C:\macro.xlsm"
Call, e.g. from a VBA task
Sub CallMacro ()
Dim hWnd As Long
hWnd = VBA.Shell ("C:\startMacro.cmd " & Chr (34) & "Whatever you want" & Chr (34), vbHide)
Another possibility is the API function GetCommandLine. In this way, you don't need a batch file. Google will help.