timing sensetive code?

  • Thread starter Thread starter TimK
  • Start date Start date
T

TimK

I have a module based subroutine which is activated by a button on a button
bar. The code loads a userform and initializes it with data before making it
visible for entry and changes. The problem I'm seeing is that my
initialization actions don't appear to work when I run normally, but when I
trap the execution and step through it, everything is working as it should,
i.e. all data is transfered as desired. But when I run it full speed, the
userform comes up blank as if not of the transfers took place. A snippet of
code from this module based code is shown below. I haven't a clue what could
be causing this problem.....

If usePS Then
.TextBox27.Value = psws.Cells(p.BuildID, usercol) 'build id
.ComboBox8.Value = psws.Cells(p.Priority, usercol) 'Priority
.ComboBox25.Value = psws.Cells(p.Sprint, usercol) 'Sprint Par found
.ComboBox9.Value = psws.Cells(p.Status, usercol) 'Status
.ComboBox3.Value = psws.Cells(p.Detect, usercol) 'detection
activity
.ComboBox17.Value = psws.Cells(p.ReTestedBy, usercol) 'ReTested By
.ComboBox28.Value = psws.Cells(p.Test, usercol) 'Test case
Else
.TextBox27.Value = ""
.ComboBox25.Value = ""
.ComboBox8.Value = "" '>>>> having a timing problem with above
sets...
.ComboBox9.Value = ""
.ComboBox3.Value = ""
.ComboBox17.Value = ""
.ComboBox28.Value = ""
End If
 
Try firing your initialization actions from the UserForm initialize event.
So the sequence is

Load UserForm
Initialize the controls from the UF Initialize event
UserForm Show
 
Good Idea. I moved all the .controlsource initializing statements to the
_initialize event and it now works. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top