Creating a Custom Dialog Box
Use the following procedure to create a custom dialog box:
On the Insert menu in the Visual Basic Editor, click UserForm.
Find the control you want to add in the Toolbox and drag the control onto the form.
Right-click a control in design mode and click Properties to display the Properties window.
You can initialize controls in a procedure before you show a form, or you can add code to the Initialize event of the form.
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.
Use the Showmethod to display a UserForm.
Some properties can be set at run time. Values the user sets for controls in the dialog box are lost when the dialog box is closed.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.