LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default UserForm initialize event run when UserForm is shown

If I programmically import a UserForm with
Application.VBE.ActiveVBProject.VBComponents.Impor t ("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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm initialize Arne Hegefors Excel Programming 8 September 8th 06 01:48 PM
userform initialize Patrick Simonds Excel Programming 1 August 4th 06 11:14 PM
initialize userform, using a sub natanz[_2_] Excel Programming 11 November 22nd 05 05:30 AM
Userform to enter values and shown in same userform in list helmekki[_104_] Excel Programming 0 November 19th 05 03:23 PM
UserForm Initialize event doesn't fire reliably RB Smissaert Excel Programming 13 February 16th 05 01:39 AM


All times are GMT +1. The time now is 06:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"