Loop through workbooks in different excel instances

svjensen

Board Regular
Joined
Jun 10, 2009
Messages
118
I use a macro to loop through all open workbooks, extracting data from them.
This work fine except that I found out that if some of the workbooks are opened in an other instance of excel they are not included.

Can I force the macro to run through all instances of excel and then through all workbooks in each instance?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
It might be an idea to try and find out how the workbooks are being opened in separate instances.

Is it meant to be happening?

I'm sure it'll be possible to loop through the different instances but it's not going to be straightforward.

You would probably need to use the Windows API, which might involve looping through every 'window' that's open.

Then you would need something that identifies the instances of Excel, creates some sort of reference to them and then loop through the workbooks in each.

I think this has been answered on the board before - try a search.:)
 
Upvote 0

Forum statistics

Threads
1,216,120
Messages
6,128,948
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top