To reproduce this problem, create a new form and have this code in
Private Sub Form_Close()
Private Sub Form_Resize()
Private Sub Form_Unload(Cancel As Integer)
If the form is not maximized, the order of
events you should receive is
Resizing -> Unloading
But for maximized forms, this becomes
Unloading -> Closing -> Resizing
So, if you have a module level object variable that you're
calling from the Resize event, and if you set it to Nothing from the form's
Close event, you will likely receive Error 91 (Object variable or With block variable not set).
The workaround is to use code in the Resize event only if
a module-level boolean variable is False; and set it to true from the
form's Close event.