How can you get to all the running Excel instances?
I use to the following code for other reasons, so could it be applied here? If not, what are some other options?
sub ListRunningProcesses()
Dim winmgmtsObject As Object
Set winmgmtsObject = GetObject(“winmgmts:”)
Dim myQuery As String
myQuery = “SELECT * FROM win32_process WHERE Name = ‘EXCEL.EXE'”
Dim allProcesses As Object
Set allProcesses = winmgmtsObject.execquery(myQuery)
Dim myExcelInstance As Excel.Application
Dim excelApplication As Excel.Application
Dim myProcess As Object
For Each myProcess In allProcesses
Debug.Print myProcess.Name
‘set myExcelInstance = ???
‘Do want I need to with a valid myExcelInstance reference
Next
‘object clean up goes here
End Sub