Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Enable Property of Multipage Control Pages = CheckBox.Value

How can I enable all Pages of a Multipage Control it a checkbox = True, and
disable pages it the checkbox = False?

Sub EnablePages ()

Dim myPages as Collection
Dim ctrl as Control

'all pages in multipage paint section
Set myPages = New Collection
With myPages
.Add pgColor1
.Add pgColor2
.Add pgColor3
.Add pgColor4
.Add pgColor5
.Add pgColor6
End With

For Each ctrl In myPages
ctrl.Enabled = chkPaint.Value
Next ctrl

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Enable Property of Multipage Control Pages = CheckBox.Value

Put this into the Initialize event of the userform to set up the pages you
want:

Private Sub UserForm_Initialize()
Dim pg As Page
With Me.MultiPage1
.Pages.Remove "Page1"
.Pages.Remove "Page2"
.Pages.Add "New Page 1"
.Pages.Add "New Page 2"
.Pages.Add "New Page 3"
.Pages.Add "New Page 4"
.Pages.Add "New Page 5"
For Each pg In .Pages
pg.Enabled = Me.CheckBox1.Value
Next
End With
End Sub

Then use the click event of the check box to change the pages' status when
the checkbox changes:

Private Sub CheckBox1_Click()
Dim pg As Page
For Each pg In Me.MultiPage1.Pages
pg.Enabled = Me.CheckBox1.Value
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"RyanH" wrote in message
...
How can I enable all Pages of a Multipage Control it a checkbox = True,
and
disable pages it the checkbox = False?

Sub EnablePages ()

Dim myPages as Collection
Dim ctrl as Control

'all pages in multipage paint section
Set myPages = New Collection
With myPages
.Add pgColor1
.Add pgColor2
.Add pgColor3
.Add pgColor4
.Add pgColor5
.Add pgColor6
End With

For Each ctrl In myPages
ctrl.Enabled = chkPaint.Value
Next ctrl

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Enable Property of Multipage Control Pages = CheckBox.Value

Thats what I needed!

Thanks

"Jon Peltier" wrote:

Put this into the Initialize event of the userform to set up the pages you
want:

Private Sub UserForm_Initialize()
Dim pg As Page
With Me.MultiPage1
.Pages.Remove "Page1"
.Pages.Remove "Page2"
.Pages.Add "New Page 1"
.Pages.Add "New Page 2"
.Pages.Add "New Page 3"
.Pages.Add "New Page 4"
.Pages.Add "New Page 5"
For Each pg In .Pages
pg.Enabled = Me.CheckBox1.Value
Next
End With
End Sub

Then use the click event of the check box to change the pages' status when
the checkbox changes:

Private Sub CheckBox1_Click()
Dim pg As Page
For Each pg In Me.MultiPage1.Pages
pg.Enabled = Me.CheckBox1.Value
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"RyanH" wrote in message
...
How can I enable all Pages of a Multipage Control it a checkbox = True,
and
disable pages it the checkbox = False?

Sub EnablePages ()

Dim myPages as Collection
Dim ctrl as Control

'all pages in multipage paint section
Set myPages = New Collection
With myPages
.Add pgColor1
.Add pgColor2
.Add pgColor3
.Add pgColor4
.Add pgColor5
.Add pgColor6
End With

For Each ctrl In myPages
ctrl.Enabled = chkPaint.Value
Next ctrl

End Sub




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
Error saying Control object does not have Enable property. MikeAllgood Excel Programming 2 March 11th 08 12:24 AM
Loop through pages in multipage control ExcelMonkey Excel Programming 2 May 2nd 07 09:47 PM
how to switch pages in a multipage control by a commandbutton furbiuzzu Excel Programming 2 September 11th 06 03:16 PM
Multipage Control Pages - Changing Index Value in Code misseill Excel Programming 1 July 13th 05 04:55 PM
Multipage Control Pages - Changing Index Value in Code misseill Excel Programming 0 July 13th 05 04:32 PM


All times are GMT +1. The time now is 12:41 AM.

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

About Us

"It's about Microsoft Excel"