D
dmgathmann
If I programmically import a UserForm with
Application.VBE.ActiveVBProject.VBComponents.Import ("UserForm.frm")
and show it with
Set UserForm = VBA.UserForms.Add("UserForm")
UserForm.Show
then change any control property (in my case,
UserForm.Label1.Backcolor) in a module (rather than from within the
UserForm code), the UserForm initialize event is triggered on the
first call to the module (not on subsequent calls). Also, the control
property is changed (Backcolor), but the screendisplay doesn't reflect
this (Application.ScreenUpdating=False is not used). As expected, all
control property changes done within the UserForm code behave
properly.
This is for XL97 on Windows 98
Thanks for any help.
Dave G
UserForm Code
/// works as expected
Private Sub Label2_Click()
Static lb2Cnt As Integer
Dim IsOdd As Boolean
lb2Cnt = lb2Cnt + 1
If lb2Cnt / 2 = Int(lb2Cnt / 2) Then IsOdd = False Else IsOdd =
True
If IsOdd Then UserForm.Label2.BackColor = &HFF& Else
UserForm.Label2.BackColor = &HFF00&
End Sub
///doesn't work even though the same code (expect use Label1) as above
is in the Call routine
Private Sub Label1_Click()
'change via Call
Static lb1Cnt As Integer
Dim IsOdd As Boolean
lb1Cnt = lb1Cnt + 1
If lb1Cnt / 2 = Int(lb1Cnt / 2) Then IsOdd = False Else IsOdd =
True
Call TestViaCall(IsOdd)
End Sub
Application.VBE.ActiveVBProject.VBComponents.Import ("UserForm.frm")
and show it with
Set UserForm = VBA.UserForms.Add("UserForm")
UserForm.Show
then change any control property (in my case,
UserForm.Label1.Backcolor) in a module (rather than from within the
UserForm code), the UserForm initialize event is triggered on the
first call to the module (not on subsequent calls). Also, the control
property is changed (Backcolor), but the screendisplay doesn't reflect
this (Application.ScreenUpdating=False is not used). As expected, all
control property changes done within the UserForm code behave
properly.
This is for XL97 on Windows 98
Thanks for any help.
Dave G
UserForm Code
/// works as expected
Private Sub Label2_Click()
Static lb2Cnt As Integer
Dim IsOdd As Boolean
lb2Cnt = lb2Cnt + 1
If lb2Cnt / 2 = Int(lb2Cnt / 2) Then IsOdd = False Else IsOdd =
True
If IsOdd Then UserForm.Label2.BackColor = &HFF& Else
UserForm.Label2.BackColor = &HFF00&
End Sub
///doesn't work even though the same code (expect use Label1) as above
is in the Call routine
Private Sub Label1_Click()
'change via Call
Static lb1Cnt As Integer
Dim IsOdd As Boolean
lb1Cnt = lb1Cnt + 1
If lb1Cnt / 2 = Int(lb1Cnt / 2) Then IsOdd = False Else IsOdd =
True
Call TestViaCall(IsOdd)
End Sub