Reputation: 393
I have a XLA AddIn
macro with a main menu Userform
. I need to enable/disable boutons on this menu userform according to the Activeworkbook
.
My problem is that I don't know how to update the Userform
when the user change or close the Activeworkbook
.
I do have a UserForm_Activate
, which update the Userform
. But that event is not triggered when the user close the Activeworkbook
then click on the Userform
.
I would need to update the Userform
either :
Activeworkbook
is changed or closedUserform
(ie. before he can click on any control).How would you proceed ?
Upvotes: 0
Views: 384
Reputation: 2825
In the ThisWorkbook module of your xla:
Private WithEvents xlApp as Excel.Application
You will then see that xlApp has events such as WorkbookActivate and WorkbookDeactivate etc.
Upvotes: 2