Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: Getting back to original sub on original form after going to different form

  1. #1
    New Member
    Join Date
    Mar 2011
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Getting back to original sub on original form after going to different form

    I am writing some code that opens forms depending on text box input.

    a subroutine in form1 "shows" form2 at which time I get input from user and again go to form3 to get input. done

    I need to close form2 and form3 and

    How do I get back to the original subroutine on form1 where I too off from?

    Thanks Guys


    (oops using vba in excel 2007)
    Last edited by instanceoftime; Apr 20th, 2017 at 09:46 PM.

  2. #2
    Board Regular
    Join Date
    Jul 2014
    Location
    Rio, BR
    Posts
    350
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Getting back to original sub on original form after going to different form

    userform1. show
    userform2.hide
    userform3.hide
    ,,,,
    Using Excel/Word 2010.
    Backup your original file before doing any modification.

  3. #3
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    30,353
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Getting back to original sub on original form after going to different form

    Assuming the forms are modal, that is what should happen naturally once form 3 and form 2 are closed.

  4. #4
    New Member
    Join Date
    Mar 2011
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Getting back to original sub on original form after going to different form

    embarrassing that so easy Just didn't know it would return to the original sub. Modal?

  5. #5
    New Member
    Join Date
    Mar 2011
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Getting back to original sub on original form after going to different form

    Cool thanks. I actually had to unload the 2 forms (which is fine) rather than hide. Hide kept telling me I must hide topmost form first. I had form3 hiding then form2 hiding and even switched but kept getting the error.

  6. #6
    Board Regular
    Join Date
    Jul 2014
    Location
    Rio, BR
    Posts
    350
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Getting back to original sub on original form after going to different form

    You can use unload but note that this will "kill" any data of the form, so you can't do references after unload the form.
    Using Excel/Word 2010.
    Backup your original file before doing any modification.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com