AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,835
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi,
I came across the following via Google
After trying the above it seems the controls don't 'stay'. Looking at the Form again in design mode they've gone.
Does this means the code must be run from the Form and the controls are intended to be temporary? They vanish as the Form is closed - but otherwise are available to use in the same way as a control created at design time?
Are there any known issues that might affect their usage? Are any of the common toolbox contols excluded?
And finally, could anyone tell me (or has a link) where I can learn the parameters for the 'Set cControl =' lines ?
Many thanks, ABB
I came across the following via Google
Code:
Private Sub CommandButton1_Click()
Dim cControl As Control
Set cControl = Me.Controls.Add("Forms.Frame.1", "MyFrame", True)
With cControl
.Width = 100
.Height = 135
.Top = 0
.Left = 0
.ZOrder (1)
End With
Set cControl = Me.Controls.Add("Forms.TextBox.1", "MyTextBox", True)
With cControl
.Width = 150
.Height = 50
.Top = 20
.Left = 20
.ZOrder (0)
End With
End Sub
After trying the above it seems the controls don't 'stay'. Looking at the Form again in design mode they've gone.
Does this means the code must be run from the Form and the controls are intended to be temporary? They vanish as the Form is closed - but otherwise are available to use in the same way as a control created at design time?
Are there any known issues that might affect their usage? Are any of the common toolbox contols excluded?
And finally, could anyone tell me (or has a link) where I can learn the parameters for the 'Set cControl =' lines ?
Many thanks, ABB