Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Retrieve data from multiple Excel sessions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JessK - 26 Mar 2006 23:58 GMT
Is there code that I can write into my macro that allows me to access other
Excel sessions running on my computer to transfer data into a different
session that my macro is running in?  My situation is described below:

There is a program on my computer (DataNav) that opens a set of experiment
data in an Excel worksheet.  I am using a VBA Excel macro in a "summary" file
to grab and manipulate this data.  Everything is fine if I first allow
DataNav to open the experiment data, then open my Excel macro file in the
same Excel session.  However, when I download subsequent sets of experiment
data from DataNav, they each open as a new Excel session (not as a new window
in the same session).  This requires me to save my macro file, close its
Excel session, and then reopen my macro in the Excel session of the new
experiment data.

Can you help?
Peter T - 27 Mar 2006 21:42 GMT
It's not straightforward to reference multiple Excel instances but for your
need perhaps easier than it normally is. I assume your 3rd party app creates
a new instance then loads a default / empty workbook before populating with
data. Being unsaved this will be named BookX with no extension.  With API's
you can enumerate Windows finding (FindWindow32 and/or FindWindowEx or in
XL2k+ EnumWindows) each "XLMAIN" and child widows "XLDESK" > "EXCEL7" with
the caption BookX.

Then you can set a references to each BookX with GetObject("BookX").

Of course some of these BookX's may not be related to your third part app,
indeed there may one or more BookX in the same instance, though you will
already have determined which parent they belong to. However I imagine there
will be something in the Book identifies itself as relevant.

Having "got" the book your code could then quit it's parent application
having either retrieved the data or saved the BookX.

Regards,
Peter T

> Is there code that I can write into my macro that allows me to access other
> Excel sessions running on my computer to transfer data into a different
[quoted text clipped - 11 lines]
>
> Can you help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.