ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multipage for a Wizard (https://www.excelbanter.com/excel-programming/408044-multipage-wizard.html)

Steve

Multipage for a Wizard
 
I have a wizard that is navigated using using buttons like, Back, Next, etc.
I want to show the tab strip so the user knows what steps are next, but I
don't want them to be able to click the tabs themselves to change the page.
I want them to have to use the buttons on the wizard.

If I disable the multipage, then everything's disabled. I thought of using
a public variable and checking if it's true or not, but I'm not sure what
events to use. Please help!

Thanks,
Steve

Dave Peterson

Multipage for a Wizard
 
You can use the .visible property to hide/show pages.

I create a small userform with a multipage control with a few pages. And a
button to advance and another button to retreat.

Option Explicit
Private Sub CommandButton1_Click()
With Me.MultiPage1
If .Value = .Pages.Count - 1 Then
Beep
Else
.Pages(.Value + 1).Visible = True
.Pages(.Value).Visible = False
End If
End With
End Sub
Private Sub CommandButton2_Click()
With Me.MultiPage1
If .Value = 0 Then
Beep
Else
.Pages(.Value - 1).Visible = True
.Pages(.Value).Visible = False
End If
End With
End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.MultiPage1
.Value = 0 'first sheet
For iCtr = 1 To .Pages.Count - 1
.Pages(iCtr).Visible = False
Next iCtr
End With
Me.CommandButton1.Caption = "Next"
Me.CommandButton2.Caption = "Prev"
End Sub


steve wrote:

I have a wizard that is navigated using using buttons like, Back, Next, etc.
I want to show the tab strip so the user knows what steps are next, but I
don't want them to be able to click the tabs themselves to change the page.
I want them to have to use the buttons on the wizard.

If I disable the multipage, then everything's disabled. I thought of using
a public variable and checking if it's true or not, but I'm not sure what
events to use. Please help!

Thanks,
Steve


--

Dave Peterson

Steve

Multipage for a Wizard
 
Dave,

Thanks, but that's not exactly what I'm looking for. I want all the tabs to
be visible to the user, I just don't want him to be able to change the page
by selecting a tab. I want to force him to use the Wizard controls on the
form.

thanks,
Steve

"Dave Peterson" wrote:

You can use the .visible property to hide/show pages.

I create a small userform with a multipage control with a few pages. And a
button to advance and another button to retreat.

Option Explicit
Private Sub CommandButton1_Click()
With Me.MultiPage1
If .Value = .Pages.Count - 1 Then
Beep
Else
.Pages(.Value + 1).Visible = True
.Pages(.Value).Visible = False
End If
End With
End Sub
Private Sub CommandButton2_Click()
With Me.MultiPage1
If .Value = 0 Then
Beep
Else
.Pages(.Value - 1).Visible = True
.Pages(.Value).Visible = False
End If
End With
End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.MultiPage1
.Value = 0 'first sheet
For iCtr = 1 To .Pages.Count - 1
.Pages(iCtr).Visible = False
Next iCtr
End With
Me.CommandButton1.Caption = "Next"
Me.CommandButton2.Caption = "Prev"
End Sub


steve wrote:

I have a wizard that is navigated using using buttons like, Back, Next, etc.
I want to show the tab strip so the user knows what steps are next, but I
don't want them to be able to click the tabs themselves to change the page.
I want them to have to use the buttons on the wizard.

If I disable the multipage, then everything's disabled. I thought of using
a public variable and checking if it's true or not, but I'm not sure what
events to use. Please help!

Thanks,
Steve


--

Dave Peterson


Dave Peterson

Multipage for a Wizard
 
Select all the code and then replace .visible with .enabled:

Option Explicit
Private Sub CommandButton1_Click()
With Me.MultiPage1
If .Value = .Pages.Count - 1 Then
Beep
Else
.Pages(.Value + 1).Enabled = True
.Pages(.Value).Enabled = False
End If
End With
End Sub
Private Sub CommandButton2_Click()
With Me.MultiPage1
If .Value = 0 Then
Beep
Else
.Pages(.Value - 1).Enabled = True
.Pages(.Value).Enabled = False
End If
End With
End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.MultiPage1
.Value = 0 'first sheet
For iCtr = 1 To .Pages.Count - 1
.Pages(iCtr).Enabled = False
Next iCtr
End With
Me.CommandButton1.Caption = "Next"
Me.CommandButton2.Caption = "Prev"
End Sub


The tabs will be greyed out until you use the buttons to change pages.

steve wrote:

Dave,

Thanks, but that's not exactly what I'm looking for. I want all the tabs to
be visible to the user, I just don't want him to be able to change the page
by selecting a tab. I want to force him to use the Wizard controls on the
form.

thanks,
Steve

"Dave Peterson" wrote:

You can use the .visible property to hide/show pages.

I create a small userform with a multipage control with a few pages. And a
button to advance and another button to retreat.

Option Explicit
Private Sub CommandButton1_Click()
With Me.MultiPage1
If .Value = .Pages.Count - 1 Then
Beep
Else
.Pages(.Value + 1).Visible = True
.Pages(.Value).Visible = False
End If
End With
End Sub
Private Sub CommandButton2_Click()
With Me.MultiPage1
If .Value = 0 Then
Beep
Else
.Pages(.Value - 1).Visible = True
.Pages(.Value).Visible = False
End If
End With
End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.MultiPage1
.Value = 0 'first sheet
For iCtr = 1 To .Pages.Count - 1
.Pages(iCtr).Visible = False
Next iCtr
End With
Me.CommandButton1.Caption = "Next"
Me.CommandButton2.Caption = "Prev"
End Sub


steve wrote:

I have a wizard that is navigated using using buttons like, Back, Next, etc.
I want to show the tab strip so the user knows what steps are next, but I
don't want them to be able to click the tabs themselves to change the page.
I want them to have to use the buttons on the wizard.

If I disable the multipage, then everything's disabled. I thought of using
a public variable and checking if it's true or not, but I'm not sure what
events to use. Please help!

Thanks,
Steve


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com