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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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