The ExecExcelMacro function executes an Excel macro in the specified Excel worksheet.
Used to run an Excel macro without opening the worksheet. The macro execution is done silently and the Excel file is saved.
<Excel_filename>, string, Excel filename. If the path is not specified, the file is searched in the current working folder.
<macro_name>, string, name of the macro to execute. At the end of the macro execution, the Excel workbook is automatically saved.
<timeout>, integer. If after <timeout> seconds, the macro has not finished its execution, an error is reported (if #IgnoreErrors=1, default value) and script execution stops. If <timeout> is set to 0, there is no limitation for execution duration.
ret, optional numeric return value. If the function succeeds, the return value is 0. If the macro did not finish within the <timeout> the return code is set to -1 (see File Functions Error Codes).
ExecExcelMacro("c:\my documents\my_excel_file.xls", "my_macro",0)
ExecExcelMacro("c:\my documents\my_excel_file.xls", "PERSONAL.XLS!my_macro",30)