![]() |
Click Events on a MultiPage
In a multipage there is a main page and a 'master' edit page.
The edit page is to be replicated as required. I can copy the master controls to a new page but how do I write a click event for a cmdbutton (for example) which refers to all new pages? Currently the cmdbutton click event only refers to the master edit page control. this code generates a new page and copies controls from the master edit page Dim newPage As page With MultiPage1 Set newPage = .Pages.Add(, "Ref " & (lbx.ListIndex), .Count) .Pages(1).Controls.Copy newPage.Paste newPage.Picture = MultiPage1.Pages(1).Picture End With This code is for a cmdbutton on the master edit page Private Sub cmdDeleteChanges_Click() '''clear controls ClearControls (MultiPage1.Value) End Sub And this procedure clears the txtboxes and optbuttons on the master edit page Sub ClearControls(k As Byte) Dim i As Byte '''ignore main page If Not frmMulti.MultiPage1.Value = 0 Then Set ctrl = frmMulti.MultiPage1.Pages(k).Controls '''ignore first control For i = 1 To 9 If (TypeOf ctrl.Item(i) Is msForms.TextBox) Then ctrl.Item(i).Text = "" ElseIf (TypeOf ctrl.Item(i) Is msForms.OptionButton) Then ctrl.Item(i).Value = False End If Next i End If End Sub How can I make this 'ClearControls' proc available via the cmdbutton on each new page? Geoff |
All times are GMT +1. The time now is 08:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com