Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Retrieve data from multiple Excel sessions

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Retrieve data from multiple Excel sessions

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


"JessK" wrote in message
...
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple excel sessions rita Excel Discussion (Misc queries) 2 June 30th 09 07:37 AM
Copy and paste over multiple sessions error Brad Excel Discussion (Misc queries) 0 January 4th 08 08:10 PM
Opening Multiple Excel Sessions Lynn Excel Discussion (Misc queries) 4 March 1st 07 01:07 PM
Retrieve multiple data rows data from a very long list and copy t mathew Excel Discussion (Misc queries) 1 September 13th 06 08:24 PM
Multiple Excel Sessions tjh Excel Programming 2 November 22nd 05 12:17 AM


All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"