Consulting

Results 1 to 7 of 7

Thread: Mutlipage UserForm Referencing

  1. #1
    VBAX Regular
    Joined
    Aug 2004
    Posts
    12
    Location

    Mutlipage UserForm Referencing

    Another novice question for you.

    I have a multipage userform in a worksheet, how do I reference that same userform from different places to different pages dependent upon where the reference came from?

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Do you want to know how to change the mutipage page that is active?

    UserForm1.MultiPage1.Value = 1
    Multipage values start at 0 for the first page, 1 for the second, and so on.

  3. #3
    VBAX Regular
    Joined
    Aug 2004
    Posts
    12
    Location
    That works, thank you. Out of curiosity, why does the userform have to be opened and closed once for it to work properly? For instance, if the userform was last opened in page 3 then no matter what page it's supposed to reference next, it pulls up page 3. But, if I close the userform again and re-open it using the new reference again, it works fine. Is there a better way to close the userform than UserForm1.hide?

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    UserForm1.Hide
    Hides the User Form. It is still open and stored in memory, it is just not visible. To close the User Form use this:
    Unload Me
    'Me refers to the User Form where this code resides.
    Or
    Unload UserForm1

  5. #5
    VBAX Regular
    Joined
    Aug 2004
    Posts
    12
    Location
    I'm sorry, I should have mentioned that I tried that and it didn't work. Currently I was simply using .hide because it left the data in the form until the clear function was used to unload the form from memory.

  6. #6
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Unload InfoEntry
    And I'd use something like this, assigned to different buttons for whatever page you wanted open ...

    Sub Open_EntryInfo()
        Load InfoEntry
        InfoEntry.MultiPage1.Value = 0
        InfoEntry.Show
    End Sub

  7. #7
    VBAX Regular
    Joined
    Aug 2004
    Posts
    12
    Location
    It's working perfectly now - thanks! I worked on it earlier today and that is almost exactly the code I came up with and achieved the desired result.

Posting Permissions

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