Find all running Excel Application objects

  • Thread starter Thread starter news.bluewin.ch
  • Start date Start date
N

news.bluewin.ch

Is there a way in vbscript to find all running Excel instances and check
what their open workbooks are?

Thomas
 
news.bluewin.ch said:
Is there a way in vbscript to find all running Excel instances and check
what their open workbooks are?

Thomas


No , you can call system API's to list all running processes
to count the number of excel instances running but
AFAIK there's no way to specify which yu want to connect
to so as to be able to use automation to check the open
workbooks

Keith
 
Hi Thomas,

As Keith pointed out, there's no simple way to do this. You could use
GetObject to get a running instance of Excel, then loop through the Workbook
objects. But there's no way to keep calling GetObject to get new instances
AFAIK.

You'll probably end up using the Windows API functions EnumWindows and
EnumChildWindows to do this. The main Excel application has a class name of
"XLMAIN", and it seems that the workbooks are listed under a subwindow of
XLMAIN with a class name of "XLDESK" (each workbook under XLDESK has a class
name of "EXCEL7"). These may be different in different versions of Excel
(mine is 2002).

Here's a page that has a great utility that should get you started:

http://vbnet.mvps.org/index.html?code/enums/enumwindowsdemo.htm

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Hi Thomas,
I posted this a while ago. It was used to avoid using specfic instances of Excel while getting an object.
I will enumerate all running instances (and all running tasks). It can be modified to enumerate all workbooks within each instance.
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=#d59pH8nCHA.2288@TK2MSFTNGP10


--
John
johnf 202 at hotmail dot com


| Is there a way in vbscript to find all running Excel instances and check
| what their open workbooks are?
|
| Thomas
|
|
 
Back
Top