PC Review


Reply
Thread Tools Rate Thread

Change properties of a multipage

 
 
Gerhard Ganser
Guest
Posts: n/a
 
      1st Jul 2008
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 ***
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      1st Jul 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 ***



 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      1st Jul 2008
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 ***
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Jul 2008
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
 
Reply With Quote
 
Oscar
Guest
Posts: n/a
 
      2nd Jul 2008


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 ***
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      2nd Jul 2008
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" <(E-Mail Removed)> wrote in message
news:%239xISF%(E-Mail Removed)...
>
>
> 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 ***



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change a caption for multipage Oakleaf tech Microsoft Excel Programming 2 7th Sep 2009 02:27 PM
MultiPage exit/change event Patrick Simonds Microsoft Excel Programming 2 29th Aug 2006 04:06 AM
change label on multipage koenigma@hotmail.com Microsoft Excel Programming 3 27th Aug 2006 05:51 PM
MultiPage change CRASH! Drummer361 Microsoft Excel Programming 0 21st Aug 2006 04:26 PM
Re: Deactivating Multipage Change Event marston.gould@alaskaair.com Microsoft Excel Programming 0 9th Sep 2004 03:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:48 AM.