espenskeie
Well-known Member
- Joined
- Mar 30, 2009
- Messages
- 636
- Office Version
- 2016
- Platform
- Windows
Hi
I have placed next and back buttons in the userform. I have a total of 8 pages.
The problem is that page 2 and 4 is not active. And I cannot see why. In the properties of the pages the data is exactly the same at all pages.
Are there errors in my code?
Regards
Espen
I have placed next and back buttons in the userform. I have a total of 8 pages.
The problem is that page 2 and 4 is not active. And I cannot see why. In the properties of the pages the data is exactly the same at all pages.
Are there errors in my code?
Code:
Private Sub cmdNext_Click()
MultiPage1.Value = MultiPage1.Value + 1
End Sub
Private Sub cmdBack_Click()
Dim intPage As Integer
intPage = MultiPage1.Value
Do
intPage = intPage - 1
If intPage = 0 Then Exit Do
Loop While Not MultiPage1.Pages(intPage).Enabled
MultiPage1.Value = intPage
End Sub
Private Sub MultiPage1_Change()
If MultiPage1.Value = 0 Then
cmdNext.Enabled = True
cmdBack.Enabled = False
ElseIf MultiPage1.Value = (MultiPage1.Pages.Count - 1) Then
cmdNext.Enabled = False
cmdBack.Enabled = True
Else
cmdNext.Enabled = True
cmdBack.Enabled = True
End If
End Sub
Regards
Espen