无法从macros设置目标工作表

我有这个处理macros,我添加到2个Excel文件,一切工作的子。

现在我已经知道要处理的文件不会有这些macros,我应该将它们存储在别处。 我把它们放在一个空的工作簿,我可以调用macros。

问题是,它的目标本身(一个空的工作簿)。 我需要在我打开的Excel上工作(x1)

原来是这样

xl.Run macroName 

macros和目标工作表包含在这里

现在我有这个,但我需要它在x1的工作表上运行,而不是它本身。

 myMacro.Run macroName 'runs but no worksheets here 

这里是子的完整代码

 Sub prepareReport(macroName As String) Dim myMacro As Object Dim xl As Object Dim filePath As String Dim fileName As String fileName = determineFileNameAuto(macroName) filePath = CurrentProject.Path + "\source_files\" + fileName 'load macro-excel files Set myMacro = CreateObject("Excel.Application") myMacro.Workbooks.Open (myMacroFilePath) 'Load Excel file, then open the target workbook. Set xl = CreateObject("Excel.Application") xl.Workbooks.Open (filePath) 'Run the macros 'originally was 'xl.Run macroName 'macros were contained within file 'this will run but the target should be the x1 workbook myMacro.Run macroName ' Close and save the workbook, then close Excel echoBackToForm ("Closing Workbook") xl.ActiveWorkbook.Close (True) xl.Quit 'Step 5: Memory Clean up. Set xl = Nothing End Sub