Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding some pages on multi page form
I have a multipage form used to colloect user data. I would like to hide some
of the pages and show them only if a valid password has been entered. Can anyone help? -- AJM1949 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding some pages on multi page form
I created a small userform with 3 commandbuttons, a multipage with 5 pages, and
a textbox. commandbutton1 and textbox1 were used to get the password. commandbutton2 was used to cancel (and unload the form) commandbutton3 was used as the "real" ok button This is the code I had under the userform: Option Explicit Private Sub CommandButton1_Click() Const CorrectPWD As String = "hi" Dim iCtr As Long Dim myPagesToSee() As Boolean ReDim myPagesToSee(0 To Me.MultiPage1.Pages.Count - 1) 'hide the password box and its button Me.TextBox1.Visible = False Me.CommandButton1.Visible = False For iCtr = 0 To Me.MultiPage1.Pages.Count - 1 'default to show the page myPagesToSee(iCtr) = True Next iCtr If Me.TextBox1.Value = CorrectPWD Then 'ok to see everything, don't change anything Else 'my test choices to hide (showing 1 & 2) myPagesToSee(0) = False myPagesToSee(3) = False myPagesToSee(4) = False End If For iCtr = 0 To Me.MultiPage1.Pages.Count - 1 Me.MultiPage1.Pages(iCtr).Visible = myPagesToSee(iCtr) Next iCtr Me.CommandButton2.Visible = True Me.MultiPage1.Visible = True End Sub Private Sub CommandButton3_Click() 'always cancel Unload Me End Sub Private Sub UserForm_Initialize() 'hide all the multipage MultiPage1.Visible = False Me.TextBox1.Visible = True With Me.CommandButton1 .Visible = True .Caption = "Ok" End With With Me.CommandButton2 .Visible = False .Caption = "Ok" End With With Me.CommandButton3 .Visible = True .Caption = "Cancel" End With End Sub AJM1949 wrote: I have a multipage form used to colloect user data. I would like to hide some of the pages and show them only if a valid password has been entered. Can anyone help? -- AJM1949 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printing multi-pages | Excel Discussion (Misc queries) | |||
Why does Listview control shift to top on multi-page form? | Excel Programming | |||
Print all pages in a Multi page userform | Excel Programming | |||
I want to print multi pages on one page. | Excel Discussion (Misc queries) | |||
how do i set up multi page user form | Excel Discussion (Misc queries) |