Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Selecti Page in Userform by Name not Number


I understand the use of this command:

Menu.MultiPage1.Pages(8).Enabled = True

BUT what I would like to do is not use a page number and use the Pages name
instead, is this possible?

Something like:

Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Selecti Page in Userform by Name not Number

I don't think that you can do it that easily, what you can do is run
through all pages and look for the name:

'----------------------------------
Function return_pageNum(PageName As String) As Byte

return_pageNum = 0

For i = 0 To Me.MultiPage1.Pages.Count
Debug.Print Me.MultiPage1.Pages(i).Name
If LCase(Me.MultiPage1.Pages(i).Name) = LCase(PageName) Then
return_pageNum = i
Exit For
End If
Next i

End Function
'----------------------------------

if there is an easier possibility, i'm eager to learn.

cheers carlo

On Dec 21, 10:49*am, Trefor wrote:
I understand the use of this command:

Menu.MultiPage1.Pages(8).Enabled = True

BUT what I would like to do is not use a page number and use the Pages name
instead, is this possible?

Something like:

Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Selecti Page in Userform by Name not Number

Wait a second...i just tried it and this works for me:

me.multipage1.pages("mypage").enabled = true

what excel are you using?

Carlo

On Dec 21, 11:04*am, carlo wrote:
I don't think that you can do it that easily, what you can do is run
through all pages and look for the name:

'----------------------------------
Function return_pageNum(PageName As String) As Byte

return_pageNum = 0

For i = 0 To Me.MultiPage1.Pages.Count
* * Debug.Print Me.MultiPage1.Pages(i).Name
* * If LCase(Me.MultiPage1.Pages(i).Name) = LCase(PageName) Then
* * * * return_pageNum = i
* * * * Exit For
* * End If
Next i

End Function
'----------------------------------

if there is an easier possibility, i'm eager to learn.

cheers carlo

On Dec 21, 10:49*am, Trefor wrote:



I understand the use of this command:


Menu.MultiPage1.Pages(8).Enabled = True


BUT what I would like to do is not use a page number and use the Pages name
instead, is this possible?


Something like:


Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Selecti Page in Userform by Name not Number

Did you rename the page to that Name? Notice the OP has a space in his
"name", which must mean he is trying to reference the page through its
Caption, not its Name.

Rick


"carlo" wrote in message
...
Wait a second...i just tried it and this works for me:

me.multipage1.pages("mypage").enabled = true

what excel are you using?

Carlo

On Dec 21, 11:04 am, carlo wrote:
I don't think that you can do it that easily, what you can do is run
through all pages and look for the name:

'----------------------------------
Function return_pageNum(PageName As String) As Byte

return_pageNum = 0

For i = 0 To Me.MultiPage1.Pages.Count
Debug.Print Me.MultiPage1.Pages(i).Name
If LCase(Me.MultiPage1.Pages(i).Name) = LCase(PageName) Then
return_pageNum = i
Exit For
End If
Next i

End Function
'----------------------------------

if there is an easier possibility, i'm eager to learn.

cheers carlo

On Dec 21, 10:49 am, Trefor wrote:



I understand the use of this command:


Menu.MultiPage1.Pages(8).Enabled = True


BUT what I would like to do is not use a page number and use the Pages
name
instead, is this possible?


Something like:


Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Selecti Page in Userform by Name not Number

Carlo,

Thanks for your help, between you and Rick its fixed thanks.
--
Trefor


"carlo" wrote:

Wait a second...i just tried it and this works for me:

me.multipage1.pages("mypage").enabled = true

what excel are you using?

Carlo

On Dec 21, 11:04 am, carlo wrote:
I don't think that you can do it that easily, what you can do is run
through all pages and look for the name:

'----------------------------------
Function return_pageNum(PageName As String) As Byte

return_pageNum = 0

For i = 0 To Me.MultiPage1.Pages.Count
Debug.Print Me.MultiPage1.Pages(i).Name
If LCase(Me.MultiPage1.Pages(i).Name) = LCase(PageName) Then
return_pageNum = i
Exit For
End If
Next i

End Function
'----------------------------------

if there is an easier possibility, i'm eager to learn.

cheers carlo

On Dec 21, 10:49 am, Trefor wrote:



I understand the use of this command:


Menu.MultiPage1.Pages(8).Enabled = True


BUT what I would like to do is not use a page number and use the Pages name
instead, is this possible?


Something like:


Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Selecti Page in Userform by Name not Number

The problem is you are trying to use the Caption property to identify the
Page within the collection, not the Page's name. When you click on the tab
for the "Main Menu", look at the Properties window... see the Name, it is
Page8 (or whatever number your page is). Change the name to MainMenu
(notice, because it is a name, you can't have a separating space in it);
now, change "Main Menu" to "MainMenu" in your code statement and it should
work the way you are expecting.

Rick


I understand the use of this command:

Menu.MultiPage1.Pages(8).Enabled = True

BUT what I would like to do is not use a page number and use the Pages
name
instead, is this possible?

Something like:

Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Selecti Page in Userform by Name not Number

Rick,

Spot on thanks. Should have thought about that myself.

--
Trefor


"Rick Rothstein (MVP - VB)" wrote:

The problem is you are trying to use the Caption property to identify the
Page within the collection, not the Page's name. When you click on the tab
for the "Main Menu", look at the Properties window... see the Name, it is
Page8 (or whatever number your page is). Change the name to MainMenu
(notice, because it is a name, you can't have a separating space in it);
now, change "Main Menu" to "MainMenu" in your code statement and it should
work the way you are expecting.

Rick


I understand the use of this command:

Menu.MultiPage1.Pages(8).Enabled = True

BUT what I would like to do is not use a page number and use the Pages
name
instead, is this possible?

Something like:

Menu.MultiPage1.Pages("Main Menu").Enabled = True
--
Trefor



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format page number in excel footer to start at a specific page # straitctrydncr Excel Discussion (Misc queries) 4 April 28th 23 07:45 PM
Remove big gray page number on Page Break Preview??? annafred Excel Discussion (Misc queries) 1 January 9th 07 02:28 AM
change and/or remove page number watermark in page break preview juga Excel Discussion (Misc queries) 2 December 25th 06 10:15 AM
How do I print a one page spreadsheet multiple time, each with its own page number? lhsallwasser Excel Discussion (Misc queries) 4 August 17th 05 03:00 PM
Hide a page in a multi page userform Ian Mangelsdorf Excel Programming 1 October 27th 04 09:06 AM


All times are GMT +1. The time now is 03:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"