在另一个工作簿上运行一个macros,然后closures该macros的工作簿
如何
1.从当前(FIRST.XLSM)工作簿运行macros以打开另一个工作簿(SECOND.XLSM)
2.closures(FIRST.XLSM)的(SECOND.XLSM)工作簿上运行macros,然后继续其过程我试过这个:
Sub FirstMacro() Workbooks.Open Range("f90") 'second workbook full path Workbooks("first.XLSM").Close SaveChanges:=True 'save first workbook and close Second_Workbook_Macro ' run second workbook macro End Sub
但是由于它保存并closures了第一个工作簿,vba不会继续执行它的程序。
任何build议…并提前感谢
Sub FirstMacro() Dim wb As Workbook Set wb = Workbooks.Open Range("f90") 'second workbook full path Application.Run "'" & wb.Name & "'!Second_Workbook_Macro" ThisWorkbook.Close SaveChanges:=True 'save first workbook and close End Sub