Reputation: 93
I know to run a macro in a module from vbscript it's as simple as
objexcel.Application.Run "Filename!MacroName"
But, what if the file name is variable--but the directory only contains one file (which has already been opened)?
Could it be as simple as:
objexcel.Application.Run wkbk.path "Macroname"
Upvotes: 0
Views: 1783
Reputation: 34075
Assuming wkbk
is a workbook object, you can use:
objexcel.Application.Run "'" & wkbk.Name & "'!Macroname"
the single quotes are there in case the workbook name contains spaces. Note you don't need the path since the workbook is open.
Upvotes: 0