View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default new instances of nested controls

' in say form initialize event
Dim newPage As Page
Dim nPages As Long
Dim i As Long

With Me.MultiPage1
nPages = .Count
.Pages(0).Controls.Copy ' copy first page

For i = 1 To 4 ' 20
Set newPage = .Pages.Add("Page" & (nPages + i), _
"New-Page " & (nPages + 1), nPages)
newPage.Paste
nPages = nPages + 1
Next
End With

You will probably want to sub-class events for all controls on each page,
including the original page.

Regards,
Peter T

"nytrex" wrote in message
oups.com...
Hoping some fo your experts out there can help.

I'm working on an application that has a multipage control, with
several controls within it.

Depending on the value of a variable I would like to copy and paste
that multipaga control (with the nested controls in it) on the userform
x number of times.

I know I could easily create many 20 or so copies of the multipage
control at deisgn time and just hide the ones I don't need, but this
seems like a rather crude method of implementing what I want to do

Is there an easy way replicating a multipage control (with the nested
controls) several times within a userform?

I would appreciate any help you can give.

Regards