View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gixxer_J_97[_2_] Gixxer_J_97[_2_] is offline
external usenet poster
 
Posts: 206
Default pasting controls

hi all,

i have a multipage (MultiPage1) with controls on it (labels, textboxes and
combo boxes).

page1 (index 0) will always be there.

this function should add a new page, and copy all the controls from the
first page, and paste them on to the newly added page:

Private Sub AddAnother_Click()
MultiPage1.Pages.Add "Page" & (MultiPage1.Pages.Count + 1), "Address " &
(MultiPage1.Pages.Count + 1), 1
MultiPage1.Pages(1).Controls.Copy
Dim newPage As Object
Set newPage = MultiPage1.Pages.Item((MultiPage1.Pages.Count - 1))
newPage.Paste
End Sub

i am getting an error on newPage.Paste
Run-time error '-2147024809 (80070057)
Could not paste the control. Invalid argument.

what am i missing?

tia

J