Finding a workbook in one of multiple Excel instances

后端 未结 3 1209
清歌不尽
清歌不尽 2020-12-06 23:48

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.App         


        
3条回答
  •  长情又很酷
    2020-12-07 00:20

    I suspect that changing the file name to add in the full file path would work, so try changing the line:

    Set wb = objApp.Workbooks("Workbook1.xlsx")
    

    To something like:

    Set wb = objApp.Workbooks("C:\Users\Documents\Workbook1.xlsx")
    

提交回复
热议问题