+ Reply to Thread
Results 1 to 4 of 4

User Form Initialize Event Issues

  1. #1
    Randy
    Guest

    User Form Initialize Event Issues

    Hi,
    Trying to show a user form, but a few of the events in the initialize
    routine aren't firing as I intend. Here is the code:

    To display the user form and trigger the intialize event:
    frmSettings.Show

    The initialize sequence:
    Private Sub frmSettings_Initialize()
    btnBusinessPlan = True '* an option button within a frame
    frameStartingMonth.Visible = False '*a frame that houses the
    combo box cboStartingMonth
    cboStartingMonth.Visible = False
    txtSourceRecordsFile.Value = Sheet2.Range("e1").Value
    Image2.Left = frmSettings.Width / 2 - Image2.Width / 2
    lblTitle1.Left = frmSettings.Width / 2 - lblTitle1.Width / 2
    lblTitle2.Left = frmSettings.Width / 2 - lblTitle2.Width / 2
    End Sub

    The first two lines in the initialize sequence are not working
    (indicated with an *). However, when I use these same commands in
    other events, they work just fine. The other lines work just fine,
    which proves that the initialize sequence is running. Any ideas as to
    why the first two lines fail in this context?

    Thanks,
    Randy Eastland


  2. #2
    Bob Phillips
    Guest

    Re: User Form Initialize Event Issues

    Even though you have renamed the form frmSettings, the Initialize works on
    the Userform so it should be

    Private Sub Userform_Initialize()

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Randy" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > Trying to show a user form, but a few of the events in the initialize
    > routine aren't firing as I intend. Here is the code:
    >
    > To display the user form and trigger the intialize event:
    > frmSettings.Show
    >
    > The initialize sequence:
    > Private Sub frmSettings_Initialize()
    > btnBusinessPlan = True '* an option button within a frame
    > frameStartingMonth.Visible = False '*a frame that houses the
    > combo box cboStartingMonth
    > cboStartingMonth.Visible = False
    > txtSourceRecordsFile.Value = Sheet2.Range("e1").Value
    > Image2.Left = frmSettings.Width / 2 - Image2.Width / 2
    > lblTitle1.Left = frmSettings.Width / 2 - lblTitle1.Width / 2
    > lblTitle2.Left = frmSettings.Width / 2 - lblTitle2.Width / 2
    > End Sub
    >
    > The first two lines in the initialize sequence are not working
    > (indicated with an *). However, when I use these same commands in
    > other events, they work just fine. The other lines work just fine,
    > which proves that the initialize sequence is running. Any ideas as to
    > why the first two lines fail in this context?
    >
    > Thanks,
    > Randy Eastland
    >




  3. #3
    Randy
    Guest

    Re: User Form Initialize Event Issues

    That works. Thanks.

    If I were to have multiple user forms, how would it know which user
    form to perform this initialization sequence on since this looks like a
    generic reference that doesn't specify which user form to apply this to?


  4. #4
    Bob Phillips
    Guest

    Re: User Form Initialize Event Issues

    It doesn't matter because the initialize code is in the userform code
    module, so it knows it would apply to that form. Each form would have its
    own, separate, code module.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Randy" <[email protected]> wrote in message
    news:[email protected]...
    > That works. Thanks.
    >
    > If I were to have multiple user forms, how would it know which user
    > form to perform this initialization sequence on since this looks like a
    > generic reference that doesn't specify which user form to apply this to?
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1