F
Fred Holmes
I'm trying to get the AfterUpdate event to work in a TextBox on a
UserForm. It works fine if the TextBox is created using the Controls
Toolbox and placing the TextBox on the form in the "conventinal"
manner. However, I'm trying to use a TextBox that is created with a
Set statemnt in the UserForm code.
Dim WithEvents txtZoom As MSForms.TextBox
Set txtZoom = Me.Controls.Add("forms.TextBox.1", "txtZoom", True)
With txtZoom
.Visible = True
.Top = 3
.Left = 50
.Height = 18
.Width = 40
.Text = "100"
.TextAlign = fmTextAlignCenter
.BackStyle = fmBackStyleOpaque
.BackColor = &H80000005 ' White
.BorderStyle = fmBorderStyleSingle
.BorderColor = &H80000006 ' black
.SpecialEffect = fmSpecialEffectSunken
.Font.Size = 10
.Font.Bold = True
.EnterFieldBehavior = fmEnterFieldBehaviorSelectAll
.EnterKeyBehavior = False
.HideSelection = True
.SelectionMargin = True
.TabKeyBehavior = False
.IMEMode = fmIMEModeNoControl
End With
Private Sub txtZoom_AfterUpdate() ' AfterUpdate, not Change
' This sholud execute the zoom function by pressing Enter
' This works fine on the Old Form, but not on the New Form
' in which all of the controls are created by Set statements
' in Code. AfterUpdate does not "fire" on the new Form.
Me.Zoom = txtZoom.Text
Me.Height = hf * (txtZoom.Text / 100) ' hf = initial form height
Me.Width = wf * (txtZoom.Text / 100) ' wf = initial form width
End Sub ' Private Sub txtZoom_AfterUpdate()
The properties listed in the code for txtZoom are those taken from the
Properties dialog of the verision in which the controls are created on
the form in the "customary" fashion. I tried to make sure that any
property that looked at all "relevant" was set to an identical value
in both instances.
MS Office 2003, SP-1 WinXP, SP-2
Thanks for any help.
Fred Holmes
UserForm. It works fine if the TextBox is created using the Controls
Toolbox and placing the TextBox on the form in the "conventinal"
manner. However, I'm trying to use a TextBox that is created with a
Set statemnt in the UserForm code.
Dim WithEvents txtZoom As MSForms.TextBox
Set txtZoom = Me.Controls.Add("forms.TextBox.1", "txtZoom", True)
With txtZoom
.Visible = True
.Top = 3
.Left = 50
.Height = 18
.Width = 40
.Text = "100"
.TextAlign = fmTextAlignCenter
.BackStyle = fmBackStyleOpaque
.BackColor = &H80000005 ' White
.BorderStyle = fmBorderStyleSingle
.BorderColor = &H80000006 ' black
.SpecialEffect = fmSpecialEffectSunken
.Font.Size = 10
.Font.Bold = True
.EnterFieldBehavior = fmEnterFieldBehaviorSelectAll
.EnterKeyBehavior = False
.HideSelection = True
.SelectionMargin = True
.TabKeyBehavior = False
.IMEMode = fmIMEModeNoControl
End With
Private Sub txtZoom_AfterUpdate() ' AfterUpdate, not Change
' This sholud execute the zoom function by pressing Enter
' This works fine on the Old Form, but not on the New Form
' in which all of the controls are created by Set statements
' in Code. AfterUpdate does not "fire" on the new Form.
Me.Zoom = txtZoom.Text
Me.Height = hf * (txtZoom.Text / 100) ' hf = initial form height
Me.Width = wf * (txtZoom.Text / 100) ' wf = initial form width
End Sub ' Private Sub txtZoom_AfterUpdate()
The properties listed in the code for txtZoom are those taken from the
Properties dialog of the verision in which the controls are created on
the form in the "customary" fashion. I tried to make sure that any
property that looked at all "relevant" was set to an identical value
in both instances.
MS Office 2003, SP-1 WinXP, SP-2
Thanks for any help.
Fred Holmes