Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple excel sessions | Excel Discussion (Misc queries) | |||
Copy and paste over multiple sessions error | Excel Discussion (Misc queries) | |||
Opening Multiple Excel Sessions | Excel Discussion (Misc queries) | |||
Retrieve multiple data rows data from a very long list and copy t | Excel Discussion (Misc queries) | |||
Multiple Excel Sessions | Excel Programming |