ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change properties of a multipage (https://www.excelbanter.com/excel-programming/413375-change-properties-multipage.html)

Gerhard Ganser

Change properties of a multipage
 
I am working with Excel 2007
I have a form (frmMenu) with a multipage (Multipage1)containing 4 pages
(pg1, pg2, pg3, pg4).

I would like to change the visible property of page 4 (pg4) from true to
false using VBA code. I don't seem to be able to find the code needed
to select pg4 to change the properties of this page.

Can you help?



*** Sent via Developersdex http://www.developersdex.com ***

Peter T

Change properties of a multipage
 
Click the form to toggle visibility of page-4

Private Sub UserForm_Click()
With Me.MultiPage1.Pages(3)
.Visible = Not .Visible
End With
End Sub

Multipage pages are indexed from zero, so MultiPage1.Pages(3) refers to the
4th page

Regards,
Peter T

"Gerhard Ganser" wrote in message
...
I am working with Excel 2007
I have a form (frmMenu) with a multipage (Multipage1)containing 4 pages
(pg1, pg2, pg3, pg4).

I would like to change the visible property of page 4 (pg4) from true to
false using VBA code. I don't seem to be able to find the code needed
to select pg4 to change the properties of this page.

Can you help?



*** Sent via Developersdex http://www.developersdex.com ***




RyanH

Change properties of a multipage
 
I'm not sure where you would want this code. Maybe you could insert in under
an Event or insert it into some of you current code but this line will help.

MultiPage1.Pages(3).Visible = True

"MultiPage1" is the name of multipage. So if you have a different name you
will have to change it. The Page Index in a MultiPage starts at 0 by
default. For example, Pages(0) = pg1, Pages(1) = pg2, etc.

Hope this helps!
--
Cheers,
Ryan


"Gerhard Ganser" wrote:

I am working with Excel 2007
I have a form (frmMenu) with a multipage (Multipage1)containing 4 pages
(pg1, pg2, pg3, pg4).

I would like to change the visible property of page 4 (pg4) from true to
false using VBA code. I don't seem to be able to find the code needed
to select pg4 to change the properties of this page.

Can you help?



*** Sent via Developersdex http://www.developersdex.com ***


Dave Peterson

Change properties of a multipage
 
And you can use the name of the page if you want:

Me.MultiPage1.Pages("pg4").Visible = False



Gerhard Ganser wrote:

I am working with Excel 2007
I have a form (frmMenu) with a multipage (Multipage1)containing 4 pages
(pg1, pg2, pg3, pg4).

I would like to change the visible property of page 4 (pg4) from true to
false using VBA code. I don't seem to be able to find the code needed
to select pg4 to change the properties of this page.

Can you help?

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson

Oscar

Change properties of a multipage
 


Thanks Peter

The code you sent works fine when I click the user form. I like the
toggle idea.

I would however like to activate the code from a command button that is
on one of the multipages. I have used the code

frmMenu.Multipage1.Pages(3).visible =false

or by modifying your code as follows

With frmMenu.Multipage1.Pages(3)
.visible = not.visible

For some reason it does not seem to identify the page to change the
visible property.

Any thoughts
Thanks again for your help so far!

*** Sent via Developersdex http://www.developersdex.com ***

Peter T

Change properties of a multipage
 
I ran similarly from a button on a multipage and it worked absolutely fine.
Even if the button is on the page-4 it can at least make itself not visible.

Try this, in your commandbutton's click event

Private Sub CommandButton1_Click()
With Me.MultiPage1.Pages(3)
.Visible = Not .Visible
Me.Caption = UserForm1.MultiPage1.Pages(3).Visible
Me.Caption = .Name & " visible=" & .Visible
End With
End Sub

Regards,
Peter T


"Oscar" wrote in message
...


Thanks Peter

The code you sent works fine when I click the user form. I like the
toggle idea.

I would however like to activate the code from a command button that is
on one of the multipages. I have used the code

frmMenu.Multipage1.Pages(3).visible =false

or by modifying your code as follows

With frmMenu.Multipage1.Pages(3)
visible = not.visible

For some reason it does not seem to identify the page to change the
visible property.

Any thoughts
Thanks again for your help so far!

*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 03:13 PM.

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