Set reference to an open application
Posted on 2001-06-07
I want to determine if a Microsoft application (Excel, Access, Word, etc.) is curently running and set a reference to it. I then need to check all parent windows to see if a child window is a specific file name.
I have tried GetObject and AppActivate, but GetObject just creates a new instance of the application even if one is open. AppActivate does not seem to see the application, perhaps because its window is minimized.
I can use API functions like GetWindow and determine is the applicationis running, and I can use other functions to enumerate windows, child windows, return handles to windows, etc. However, I cannot get VB to set a reference to it.
The Shell function seems to mess up Excel, as I get the Application Title bar but the user window is as previous and I cannot use the Excel menu.
Does anyone have any ideas?