I have a problem to find a simple way to cycle through all open instances of Excel and check if a specific workbook is already open.
I already know how to do it for only one instance:
- GetObject
- Check if Workbook is open
And i found a way to check how many instances are open / get the process id's of the open instances:
Dim Counter As Int16 = 0
Dim ExcelIDs() As Int16
Dim ExcelApplications() As Process = Process.GetProcessesByName("EXCEL")
For Each ExcelApplication As Process In ExcelApplications
Counter += 1
ReDim Preserve ExcelIDs(Counter)
ExcelIDs(Counter) = ExcelApplication.Id
Next
The Problem is that (to my knowledge) it's impossible to get a specific instance of excel with the GetObject command.
So what i would need is to find a way to either access specific instances ( eg. via the collected ID's) or any other way to loop through all the open instances.
Thanks