Cannot run the macro… the macro may not be available in this workbook

I am trying to call a sub on a different worksheet but I got a run time error message.

Specifically, I have two worksheets and multiple VBA sub s in those worksheets. In one of the VBA Project (say workbook1.xlsm), I have the following code:

Sub AnalysisTableMacro()
Workbooks("Python solution macro.xlsm").Activate
Application.Run "Python solution macro.xlsm!.PreparetheTables"
End Sub

But I got the following error. The macros on both worksheets are enabled. In both worksheets, the subs are in Module1.

Cannot run the macro ‘Workbook.xlsm!PrepareTheTables’. The macro may not be available in >this workbook or all macros may be disabled.

I also tried Application.Run "Python solution macro.xlsm!Module1.PreparetheTables" but did not work.

Leave a Comment