Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
perhaps - im using 2003
here's the help listing: Add, Cut, Paste Methods, Page Object, MultiPage Control Example The following example uses the Add, Cut, and Paste methods to cut and paste a control from a Page of a MultiPage. The control involved in the cut and paste operations is dynamically added to the form. This example assumes the user will add, then cut, then paste the new control. To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains: Three CommandButton controls named CommandButton1 through CommandButton3. A MultiPage named MultiPage1. Dim MyTextBox As Control Private Sub CommandButton1_Click() Set MyTextBox = MultiPage1.Pages(MultiPage1.Value).Controls_ .Add("MSForms.TextBox.1", "MyTextBox", Visible) CommandButton2.Enabled = True CommandButton1.Enabled = False End Sub Private Sub CommandButton2_Click() MultiPage1.Pages(MultiPage1.Value).Controls.Cut CommandButton3.Enabled = True CommandButton2.Enabled = False End Sub Private Sub CommandButton3_Click() Dim MyPage As Object Set MyPage = _ MultiPage1.Pages.Item(MultiPage1.Value) MyPage.Paste CommandButton3.Enabled = False End Sub Private Sub UserForm_Initialize() CommandButton1.Caption = "Add" CommandButton2.Caption = "Cut" CommandButton3.Caption = "Paste" CommandButton1.Enabled = True CommandButton2.Enabled = False CommandButton3.Enabled = False End Sub "Vasant Nanavati" wrote: I see only Move, SetFocus and ZOrder. Different Excel versions, perhaps? I'm using 2002. -- Vasant "Gixxer_J_97" wrote in message ... according to the documentation you can - unless i'm looking at something incorrectly search for multipage in vba help multipage control (forms) - Example Add, Cut, Paste methods.... "Vasant Nanavati" wrote: I don't believe you can paste directly onto a MultiPage control at runtime. -- Vasant "Gixxer_J_97" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ActiveX Controls vs Form Controls | Excel Discussion (Misc queries) | |||
Pasting on Filtered Data Sheets without pasting onto hidden cells | Excel Discussion (Misc queries) | |||
Pasting numbers and formulas without pasting format. | Excel Discussion (Misc queries) | |||
Event procedures for controls added with Controls.Add | Excel Programming | |||
Pasting ActiveX or Form Controls | Excel Programming |