I have an excel file (instance #1) with code to refresh data for any open Excel file that is separate from this one.
Problem is, the other Excel file that is open was from SharePoint, so its a second instance of Excel (instance #2). My current code does not recognize instance #2. The refresh would work if the 2nd file wasnt in a separate instance.
For Each wb In Application.Workbooks
'***** Skip the "Main" workbook. Proceed for any other open workbook *****
If wb.Name <> "Main.xlsb" Then
'***** Refresh all data connections. *****
wb.RefreshAll
wb.Application.CalculateUntilAsyncQueriesDone
'***** Loop until the workbook calculation status is "Done" *****
Do Until wb.Application.CalculationState = xlDone
Loop
End If
Next wb
I was thinking that I would need to incorporate GetObject(,"Excel.Application")
but I’m not sure how to loop through the possible instances. Also, the name of the file would be different each time, so I can’t use the file path – I would like to use “excel file that isn’t this current file”.