I have a macro in Outlook VBA to grab data from an open Excel workbook ("Workbook1").
I reference the workbook as follows:
Dim objApp As Excel.Application
Set objApp = GetObject(, "Excel.Application")
Set wb = objApp.Workbooks("Workbook1.xlsx")
I often get runtime error 9, that VBA cannot find the workbook.
I think since I have more than one Excel instance open, VBA is looking for my workbook in the wrong instance.
How do I reference my workbook when running more than one Excel instance?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…