G
Guest
Is it possible to attach to an open process and perform automation on it?
I have an application that needs to manipulate Excel files extensively.
Most of the manipulation goes on with Excel application hidden.
But sometimes I need the user to edit the Excel files.
Before parsing the file again, I would like to check that it is not left
open and potentially unsaved in an Excel application window.
I know it is not possible to run this code:
Dim a As Excel.Application
For Each p As Process In Process.GetProcessesByName("Excel")
a = DirectCast(p, Excel.Application)
'Check if any of these processes:
'1) Are Hidden remnants from previous unsuccessful
automation and needs to be closed
'2) Have a specific file open that needs to be saved before
it is read
Next
But is there some similar method to attach to an Excel process and get hold
of it as an automation object that can be investigated?
Or is there any other workarounds to accomplish the same thing?
I have an application that needs to manipulate Excel files extensively.
Most of the manipulation goes on with Excel application hidden.
But sometimes I need the user to edit the Excel files.
Before parsing the file again, I would like to check that it is not left
open and potentially unsaved in an Excel application window.
I know it is not possible to run this code:
Dim a As Excel.Application
For Each p As Process In Process.GetProcessesByName("Excel")
a = DirectCast(p, Excel.Application)
'Check if any of these processes:
'1) Are Hidden remnants from previous unsuccessful
automation and needs to be closed
'2) Have a specific file open that needs to be saved before
it is read
Next
But is there some similar method to attach to an Excel process and get hold
of it as an automation object that can be investigated?
Or is there any other workarounds to accomplish the same thing?