Search code examples
excelvbauserform

Commandbutton page selection


So I have a commandbutton on a excel sheet and when I click on it brings up the userform But the page isn't starting from "Page1" rather its the page I was last using in the userform developer window. Therefore is there a way once clicked into the commandbutton the userform load up the first page everytime?

At the moment the commandbutton contains this (Userform is named as "WizardProp":

Private Sub CommandButton1_Click()
  WizardProp.Show
End Sub

and the Openform contains this:

Sub openform()
WizardProp.Show
WizardProp.tbClient.SetFocus
End Sub

Solution

  • The visible page number of a MultiPage object is defined by its Value (starting with 0).

    Is "tbClient" the MultiPage object on your userform? Then place this code in your userform's initialization:

    Private Sub WizardProp_Initialize()
        WizardProp.tbClient.Value = 0
    End Sub