+ Reply to Thread
Results 1 to 5 of 5

VBA Code Sequence Question

  1. #1
    Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    270

    VBA Code Sequence Question

    In the following Code, would the "Exit Here:" code run even if there is no error? Because sometimes I get an error when I have my close in both places.

    Please Login or Register  to view this content.

    Thanks in advance,

    Dan
    Last edited by split_atom18; 05-28-2010 at 09:41 AM. Reason: Marked Solved & Removed Post Icon
    "I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
    If my advice has been helpful to you, then please help me by clicking on the "Star" and adding to my reputation, Thanks!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Code Sequence Question

    Sure. You need an Exit Sub before Exit Here.

    And this is a preferable declaration:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    270

    Re: VBA Code Sequence Question

    Thank you this answers my question perfectly!!!
    I can use the preferable, side note question. Why? i.e. why have 2 statements to do one?

    Thanks in advance,

    Dan
    Last edited by shg; 05-27-2010 at 05:54 PM. Reason: deleted quote

  4. #4
    Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    270

    Re: VBA Code Sequence Question

    Another question on topic:

    Since my code seems to be buggy at best. (i.e. I am learning)

    I want to ensure I close connections even if there is an error. I learned that if the .close and =nothing are after the resume exithere, then I end up in an endless loop.

    So should I use:

    Please Login or Register  to view this content.

    Thanks in advance,

    Dan

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Code Sequence Question

    Why? i.e. why have 2 statements to do one?
    Read this code and decide what the two msgboxes should say. Then run it.
    Please Login or Register  to view this content.

+ 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