
03-31-2009, 03:26 AM
|
 |
Out Of Office
Retired Moderator * Expert *
|
|
Join Date: Mar 2005
Location: London, UK
Posts: 3,398
|
|
The Page object has a controls property which you can use to add the control. This is not shown by intellisense if you use an index of the multipage control's pages collection, so you may find it more transparent if you use a Page object variable.
Code:
Dim myLabel As msforms.Label
Dim pge As msforms.Page
'let's get a reference to the last page on the multipage control
'remember the index starts at 0, not 1
With MultiPage1
Set pge = .Pages(.Pages.Count - 1)
End With
Set myLabel = pge.Controls.Add("Forms.Label.1")
With myLabel
.Caption = "This is a new label"
.Visible = True
.Top = MultiPage1.Top + 5
.Left = MultiPage1.Left + 5
End With
If you type in the line in red manually, you will see intellisense kicking in and offering you the controls property.
Alternatively, you could add the label and make it hidden at design time, and then just make it visible at runtime if it is needed.
Hope that helps...
Colin
|
|