Customizing Dialog Boxes Menus And Toolbars

55x1

ra

You can use the Unload statement to remove the UserForm from memory. When you call the statement, all controls on the UserForm are reset to the default values. Therefore, you cannot access the options

You can hide a UserForm so that it is no longer visible when called by a macro. To hide a UserForm, you can use the Hide method, which still allows you to access the form from your procedure.

specified by the user after the UserForm unloads from memory. To ensure that you can access the necessary values, you can

1 TYPE THIS:

UserForm1.Hide

either store the values in global variables or hide the UserForm until your procedure terminates. You either unload a UserForm by specifying the Unload statement followed by the name of the UserForm to unload, or with the shorter codes listed below.

1

1 RESULT:

Excel hides the form.

Keep in mind that after hiding a form Excel may appear to freeze as your code continues to access

1 THIS CODE: ^H

Unload UserForm1

the UserForm. This condition clears as soon as the code that accesses the UserForm finishes processing.

V

1 IS EQUIVALENT TO:

Unload Me

□ Switch to Excel and run the macro.

■ The specified UserForm displays as a custom dialog box within Excel.

—0 Type UserForml.Show vbModal, replacing UserForml with the name of the UserForm and vbModal with vbModeless to make the dialog box modeless.

□ Switch to Excel and run the macro.

■ The specified UserForm displays as a custom dialog box within Excel.

0 0

Post a comment