Sub CallAnotherMacro()

Dim WorkbookName As String
Dim MacroName As String
Dim argument1 As String
Dim argument2 As Integer
WorkbookName = "AnotherWorkbook.xlsm"
MacroName = "NameOfMacro"
argument1 = "ExampleText"
argument2 = 1

Run "'" & WorkbookName & "'!" & MacroName, argument1, argument2

End Sub
Run a macro contained in another workbook based on a variable
Tagged on: