How to: Create Custom Dialog Boxes
Use the following procedure to create a custom dialog box:
Create a UserForm
On the Insert menu in the Visual Basic Editor, click UserForm.
Add controls to UserForms
Find the control you want to add in the Toolbox and drag the control onto the form.
Set control properties
Right-click a control in design mode and click Properties to display the Properties window.
Initialize the controls
You can initialize controls in a procedure before you show a form, or you can add code to the Initialize event of the form.
Write event procedures
All controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button. You can write event procedures that run when the events occur.
Display the custom dialog box
Use the Show method to display a UserForm.
Use control values while code is running
Some properties can be set at run time. Changes made to the dialog box by the user are lost when the dialog box is closed.