+ Reply to Thread
Results 1 to 3 of 3

How to stop other macros while current macro runs

  1. #1
    Forum Contributor
    Join Date
    07-01-2005
    Posts
    103

    How to stop other macros while current macro runs

    I have several macros running, and occasionally it seems that one won't finish because another has placed a value it wasn't expecting and generates an error. Is there code I can place in the begining that will halt all other macros, then turn them back on at the end?

    On another note, does anyone know a good link that goes over some of the basics of VBA? I could use a course on the basics. THanks

    -Paul

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187
    If you put error trapping in your code (there are plenty of posts on this subject) when the error occurs control will pass to the error handling code rather than just crashing.

    HAve a look in this forum and in the help files. If you get stuck post again.

    Things to look for:
    - on error goto label
    err.number
    err.description
    resume label

    have fun

  3. #3
    K Dales
    Guest

    RE: How to stop other macros while current macro runs

    In general, macros run sequentially, not concurrently - that is, they run one
    at a time and if they call another, they pause until the one that was called
    returns its result (there are exceptions, like the OnTime procedure and
    certain event procedures, but I doubt that is what you have). So I don't
    think it is a matter of timing between macros. It is the fact that you are
    getting unexpected results. Good code has to be able to anticipate problems
    and possible "bad" input so it does not crash with an error. But it is part
    of the learning curve we all go through.

    The best thing to do is learn how to use the debug functions in the VBA
    editor, especially how to step through code and test the values of your
    variables along the way. A look in the VBA editor help file will give you
    some info - and a good book on learning vba - there are many out there.
    --
    - K Dales


    "Paul987" wrote:

    >
    > I have several macros running, and occasionally it seems that one won't
    > finish because another has placed a value it wasn't expecting and
    > generates an error. Is there code I can place in the begining that
    > will halt all other macros, then turn them back on at the end?
    >
    > On another note, does anyone know a good link that goes over some of
    > the basics of VBA? I could use a course on the basics. THanks
    >
    > -Paul
    >
    >
    > --
    > Paul987
    > ------------------------------------------------------------------------
    > Paul987's Profile: http://www.excelforum.com/member.php...o&userid=24850
    > View this thread: http://www.excelforum.com/showthread...hreadid=535505
    >
    >


+ 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