Hi,
I have a workbook with several non-modal userforms. When I switch to another workbook, the userforms are still visible. Therefore, I want to hide all userforms if the current workbook is deactivated.
I tried to loop through all user forms and hide them, but I can't manage to loop through the user forms:
I have a workbook with several non-modal userforms. When I switch to another workbook, the userforms are still visible. Therefore, I want to hide all userforms if the current workbook is deactivated.
I tried to loop through all user forms and hide them, but I can't manage to loop through the user forms:
Private Sub Workbook_Deactivate()
Dim form As UserForm
For Each form In UserForms ' This does not work
form.Hide
Next
End Sub