On this form, I’ve named the Cancel button cbCancel. You may recognize this UserForm from my Mouse To Macro mouse recording Excel Add-in. Pretend you have a userform that looks like this: Let’s walk through an example showing where it’s appropriate to use “Unload Me” to close your form. In other words, if you type Unload Me in a regular module, it will fail with an error saying “Invalid use of Me keyword.” Remember, the module doesn’t know what UserForm you want to unload! That’s because only the UserForm knows that “Me” is the UserForm. ![]() ![]() The macro above only works when you call it from an event procedure on that UserForm - like a command button. ![]() Tutorial - VBA Close UserForm Close a UserForm from UserForm Event
0 Comments
Leave a Reply. |