Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default MultiPage Parent Name

Due to screen space limitations I had to move a group of CheckBoxes
from MY UserForm onto a MultiPage on that UserForm.

The code that I used to extract info from the CheckBoxes is as follows:

Dim ctl As Control
For Each ctl In OCMC.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value = True Then
cbResult = cbResult & VBA.Left(ctl.Caption, 3)
End If
End If
Next ctl

Been trying, but can't seem to modify this to work with the CheckBoxes
on the MultiPage Control (there are three pages on the multipage and I'd
like to address all of them).

Any ideas?

Thanks,
John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default MultiPage Parent Name

What is OCMC? If it is a reference to your multipage object, the code will
not work. If it is a reference to your userform, it should work because the
controls in the multipage are still considered to have the form as their
parent object.

--
John Green
Sydney
Australia


"John Wilson" wrote in message
...
Due to screen space limitations I had to move a group of CheckBoxes
from MY UserForm onto a MultiPage on that UserForm.

The code that I used to extract info from the CheckBoxes is as follows:

Dim ctl As Control
For Each ctl In OCMC.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value = True Then
cbResult = cbResult & VBA.Left(ctl.Caption, 3)
End If
End If
Next ctl

Been trying, but can't seem to modify this to work with the CheckBoxes
on the MultiPage Control (there are three pages on the multipage and I'd
like to address all of them).

Any ideas?

Thanks,
John




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default MultiPage Parent Name

John,

OCMC is the UserForm name.
The CheckBoxes were on the UserForm and the code worked fine.
I added a Multpage object and moved the CheckBoxes onto it.
Did'nt think much about it until the code crashed.
Moved the boxes off the multipage and everything worked fine again.
Tried some different manipulations of code using what I thought was the
"Parent" name of the Multipage form, but still couldn't get it to work.

John

"John Green" wrote in message
...
What is OCMC? If it is a reference to your multipage object, the code will
not work. If it is a reference to your userform, it should work because
the
controls in the multipage are still considered to have the form as their
parent object.

--
John Green
Sydney
Australia


"John Wilson" wrote in message
...
Due to screen space limitations I had to move a group of CheckBoxes
from MY UserForm onto a MultiPage on that UserForm.

The code that I used to extract info from the CheckBoxes is as follows:

Dim ctl As Control
For Each ctl In OCMC.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value = True Then
cbResult = cbResult & VBA.Left(ctl.Caption, 3)
End If
End If
Next ctl

Been trying, but can't seem to modify this to work with the CheckBoxes
on the MultiPage Control (there are three pages on the multipage and I'd
like to address all of them).

Any ideas?

Thanks,
John






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default MultiPage Parent Name

John,

I have to revise my statement. The parent of a control in the multipage is
the page it is in. However, the controls are still in the collection of
controls in the userform. The following code iterates through every control
on the form:

Private Sub CommandButton1_Click()
Dim ctl As Control
For Each ctl In Me.Controls
MsgBox ctl.Name & ":" & ctl.Parent.Name
Next ctl
End Sub

Each page has its own collection of controls. The following code iterates
through all the controls on a page:

Private Sub CommandButton3_Click()
Dim ctl As Control
For Each ctl In MultiPage1.Page1.Controls
MsgBox ctl.Name & ":" & ctl.Parent.Name
Next ctl
End Sub

There isn't a collection of controls for the multipage object. The following
code iterates through all the controls in the pages of the multipage:

Private Sub CommandButton4_Click()
Dim ctl As Control
Dim pg As Page
For Each pg In MultiPage1.Pages
For Each ctl In pg.Controls
MsgBox ctl.Name & ":" & ctl.Parent.Name
Next ctl
Next pg
End Sub



--
John Green
Sydney
Australia


"John Wilson" wrote in message
...
John,

OCMC is the UserForm name.
The CheckBoxes were on the UserForm and the code worked fine.
I added a Multpage object and moved the CheckBoxes onto it.
Did'nt think much about it until the code crashed.
Moved the boxes off the multipage and everything worked fine again.
Tried some different manipulations of code using what I thought was the
"Parent" name of the Multipage form, but still couldn't get it to work.

John

"John Green" wrote in message
...
What is OCMC? If it is a reference to your multipage object, the code

will
not work. If it is a reference to your userform, it should work because
the
controls in the multipage are still considered to have the form as their
parent object.

--
John Green
Sydney
Australia


"John Wilson" wrote in message
...
Due to screen space limitations I had to move a group of CheckBoxes
from MY UserForm onto a MultiPage on that UserForm.

The code that I used to extract info from the CheckBoxes is as follows:

Dim ctl As Control
For Each ctl In OCMC.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value = True Then
cbResult = cbResult & VBA.Left(ctl.Caption, 3)
End If
End If
Next ctl

Been trying, but can't seem to modify this to work with the CheckBoxes
on the MultiPage Control (there are three pages on the multipage and

I'd
like to address all of them).

Any ideas?

Thanks,
John








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default MultiPage Parent Name

John,

Tried your solution and it worked like a charm.

Thanks,
John

"John Green" wrote in message
...
John,

I have to revise my statement. The parent of a control in the multipage is
the page it is in. However, the controls are still in the collection of
controls in the userform. The following code iterates through every
control
on the form:

Private Sub CommandButton1_Click()
Dim ctl As Control
For Each ctl In Me.Controls
MsgBox ctl.Name & ":" & ctl.Parent.Name
Next ctl
End Sub

Each page has its own collection of controls. The following code iterates
through all the controls on a page:

Private Sub CommandButton3_Click()
Dim ctl As Control
For Each ctl In MultiPage1.Page1.Controls
MsgBox ctl.Name & ":" & ctl.Parent.Name
Next ctl
End Sub

There isn't a collection of controls for the multipage object. The
following
code iterates through all the controls in the pages of the multipage:

Private Sub CommandButton4_Click()
Dim ctl As Control
Dim pg As Page
For Each pg In MultiPage1.Pages
For Each ctl In pg.Controls
MsgBox ctl.Name & ":" & ctl.Parent.Name
Next ctl
Next pg
End Sub



--
John Green
Sydney
Australia


"John Wilson" wrote in message
...
John,

OCMC is the UserForm name.
The CheckBoxes were on the UserForm and the code worked fine.
I added a Multpage object and moved the CheckBoxes onto it.
Did'nt think much about it until the code crashed.
Moved the boxes off the multipage and everything worked fine again.
Tried some different manipulations of code using what I thought was the
"Parent" name of the Multipage form, but still couldn't get it to work.

John

"John Green" wrote in message
...
What is OCMC? If it is a reference to your multipage object, the code

will
not work. If it is a reference to your userform, it should work because
the
controls in the multipage are still considered to have the form as
their
parent object.

--
John Green
Sydney
Australia


"John Wilson" wrote in message
...
Due to screen space limitations I had to move a group of CheckBoxes
from MY UserForm onto a MultiPage on that UserForm.

The code that I used to extract info from the CheckBoxes is as
follows:

Dim ctl As Control
For Each ctl In OCMC.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value = True Then
cbResult = cbResult & VBA.Left(ctl.Caption, 3)
End If
End If
Next ctl

Been trying, but can't seem to modify this to work with the CheckBoxes
on the MultiPage Control (there are three pages on the multipage and

I'd
like to address all of them).

Any ideas?

Thanks,
John










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
parent/child relationship between rows? Doug Excel Worksheet Functions 4 April 22nd 23 07:41 PM
Creating child worksheet from parent Vibeke Excel Worksheet Functions 7 July 9th 09 04:34 AM
Parent of the embeded excel ARHangel Excel Discussion (Misc queries) 1 May 10th 07 11:19 AM
Sorting Parent Child kcmtnbiker Excel Worksheet Functions 2 March 31st 06 01:54 AM
A parent spreedsheet problem workaholic Excel Discussion (Misc queries) 9 November 6th 05 07:35 PM


All times are GMT +1. The time now is 07:39 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"