PC Review


Reply
Thread Tools Rate Thread

Determining All Instances of Excel

 
 
samadams_2006@yahoo.ca
Guest
Posts: n/a
 
      17th Oct 2006
Hello,

I'm interested in determining all instances of Excel currently open on
my PC. I would then like to be able to loop through all of these
instances of Excel, and determine the Workbooks that are open in each
instance of Excel.

I understand that I can use something like the following code:

Dim myWB As Workbook
For Each myWB In Workbooks
MsgBox "Workbook: " & myWB.Name
Next myWB

to find all the workbooks in the current Excel Instance...but what
about all Excel Instances that are running on my PC.

Is there an easy way to do this?

Thanks
Sam Adams

 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      17th Oct 2006
Hi Sam,

> Is there an easy way to do this?


No, or rather putting something together to do that wasn't easy for me! The
problem is GetObject will return the first instance it finds. I gather with
C++ there's a method to return the 'Running Object Table' but I don't know
how to do that in VBA.

If this really important for you I can send you a workbook (code) that does
the following:

- Enumerate windows to find running Excel instances

- Also Enumerate windows to compile a list of all window captions named
BookX, (there will never be a duplicate unsaved BookX open), identify and
relate at least one BookX in each instance.

- If an instance doesn't contain an unsaved BookX use DDE (with Word) to
insert a new workbook and hide it for future use (don't know how to avoid
temporarily bringing the window to front to do that).

- Use GetObject to get one BookX from each instance or rather its parent
application.

Having got an array of WithEvents of each application gives pretty much the
same control over each as the instance containing the code. For my purposes
traps & stores changes to cells in all wb's in all instances, also a few
other things.

This is not trivial nor 100% reliable (though normally works). So as I
mentioned, unless you need this and you are relatively familiar with VBA I
wouldn't recommend it!

Regards,
Peter T
pmbthornton gmail com







<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I'm interested in determining all instances of Excel currently open on
> my PC. I would then like to be able to loop through all of these
> instances of Excel, and determine the Workbooks that are open in each
> instance of Excel.
>
> I understand that I can use something like the following code:
>
> Dim myWB As Workbook
> For Each myWB In Workbooks
> MsgBox "Workbook: " & myWB.Name
> Next myWB
>
> to find all the workbooks in the current Excel Instance...but what
> about all Excel Instances that are running on my PC.
>
> Is there an easy way to do this?
>
> Thanks
> Sam Adams
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining How Many Instances of an Application are Active Carlton Microsoft Access VBA Modules 6 12th Jan 2008 04:28 AM
Determining Excel Version =?Utf-8?B?ZHN0aWVmZQ==?= Microsoft Excel Programming 2 16th Aug 2005 03:13 PM
Determining excel range =?Utf-8?B?ZmFiZXJr?= Microsoft Access Form Coding 1 25th Mar 2005 11:27 AM
How do I isolate my Excel server (automation) from other Excel instances? Joseph Geretz Microsoft Excel Misc 4 29th Dec 2004 08:04 PM
How do I isolate my Excel server (automation) from other Excel instances? Joseph Geretz Microsoft Excel Discussion 5 29th Dec 2004 08:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:51 AM.