How to check if different workbook has been activated

winxpdows

New Member
Joined
Apr 21, 2011
Messages
24
I've built an addin to give my users different functions depending on which workbooks they are using. There are two different types of workbooks we use. Type A gets a certain set of commands, Type B gets others.

I have a custom menu and want to check when the user switches in between different workbooks (switching, opening or closing) in order to enable/disable the correct commands for which workbook they are in.

How do I check when the activeworkbook has changed from my addin? I want to run a macro whenever a different workbook has been activated


Thanks in advance for any help!!!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Thanks pedie,

That gives me the active workbook name, but I don't know how to check that against anything. I'm hoping to find a way that I can run a macro whenever the active workbook has changed to another one.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

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