Window change event?

K

Kevin

Is there such thing as a window change event?

I have code that resides in an add-in and I would like to have a macro in
there that would run whenever another open workbook is selected via windows
drop down or alt/tab??
 
D

Dave Peterson

If you go into the VBE and click on the ThisWorkbook item in the project
explorer, you can use the dropdowns at the top of the righthand side window.

You can choose "Workbook" in the lefthand side dropdown and then choose either
Workbook_WindowActivate or Workbook_WindowDeactivate.
 
K

Kevin

Thanks, I think I can make that work... I have an add in that all of my code
resides in and it opens different spreadsheets for each location. I wanted to
have something to keep people from selecting workbooks not having to do with
these particular spreadsheets while any of them are still open.

I'll have the windows_deactivate call a macro to check wether or not the
activeworkbook is part of the project or not...

Thanks again...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top