Adding a sub procedure to show the User Form

The UserForm is now designed and coded. You only need to add a simple sub procedure to display the UserForm.

On the x The module that you create in these steps is available on the CD that accompa-

CD-ROM

. c nies this book. To add the module from the CD instead of creating it manually, choose FileoImport File, and browse for the file modAdjustWork.bas.

1. Choose InsertOModule. VBA adds a new module to the project. Note A module is simply a container for one or more procedures.

2. In the Properties window, set the name for this module to modAdjustWork.

3. In the Code window, add the following sub procedure (see Figure 25-23):

Sub ShowAdjustWorkForm () 'Display the UserForm frmAdjustWork.Show End Sub

Figure 25-23: The ShowAdjustWorkForm sub procedure displays the UserForm.

The purpose of this sub procedure is to display the UserForm called frmAdjustWork. This is the sub procedure that you will run whenever you want to run the code on the UserForm. To run this sub procedure, click any line within the sub procedure and press F5. The UserForm appears and is now functional.

Tip To avoid having to choose ToolsoMacrooMacros, you can assign your macro to a toolbar button or add it to a custom menu.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment