Modifying Your Userform For A Progress Indicator With A Multipage Control

This step assumes that you have a UserForm all set up. You'll add a MultiPage control. The first page of the MultiPage control will contain all your original controls. The second page will contain the controls that display the progress indicator. When the macro begins executing, VBA code will change the Value property of the MultiPage control. This will effectively hide the original controls and display the progress indicator.

The first step is to add a MultiPage control to your UserForm. Then move all the existing controls on the UserForm and paste them to Page1 of the MultiPage control.

Next activate Page2 of the MultiPage control and set it up as in Figure 15-2. This is essentially the same combination of controls used in the example in the previous section.

1. Add a Frame control and name it FrameProgress.

2. Add a Label control inside the Frame and name it LabelProgress. Remove the label's caption and make its background color red.

3. Add another label to describe what's going on (optional).

Figure 15-2: Page2 of the MultiPage control will display the progress indicator.

4. Next, activate the MultiPage control itself (not a page on the control) and set its Style property to 2 - fmTabStyleNone. (This will hide the tabs.) The easiest way to select the MultiPage control is to use the drop-down list in the Properties window. You'll probably need to adjust the size of the MultiPage control to account for the fact that the tabs are not displayed.

0 0

Post a comment