How can an existing macro embedded in an Excel file be executed using AutomationEdge Process Studio?
You can execute an existing Excel macro using the Execute VB Script step.
Use the following VBScript code:
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Application.Run “‘[Macro Template path]’![Module name].[Macro Name]”
objExcel.Quit
Replace:
-
[Macro Template path]: with the full Excel file path
-
[Module name]: with the module where the macro is written
-
[Macro Name]: with the actual macro name
If the macro accepts parameters, you can create process variables and pass them in the Run method like this:
objExcel.Application.Run “‘[Path]’![Module].[MacroName]”, param1, param2
This allows dynamic values to be passed from Process Studio to the Excel macro.