+ Reply to Thread
Results 1 to 3 of 3

Force macros to run one at a time

  1. #1
    Forum Contributor
    Join Date
    05-05-2004
    MS-Off Ver
    Office 365
    Posts
    651

    Force macros to run one at a time

    I have several macros being called by one button. The problem is that several of the macros being called have other macros that take a while to run and then end result is creating a PDF file that has not yet been updated.

    I recall someone once showed me how to force excel to only run one at a time as a setting, but i cant for the life of me find the setting to change that. Anyone???
    Last edited by sungen99; 12-22-2017 at 01:08 PM. Reason: spelling error

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Force macros to run one at a time

    Maybe, if you post the code, we can help you?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Force macros to run one at a time

    This is not how it should work with pure VBA (not counting running external scripts, api calls, etc).

    If you do something like the following:

    Please Login or Register  to view this content.
    Then it runs 1, then 2, then 2_1, then 3. 3 doesn't run until 2 and all its called routines complete.

    The only time this may not be accurate is if you call a sub multiple times, in which case its a design issue not a matter of timing. IE: if you call a sub, and then later call it again anything in between is run...well in between. If whats in between relies on the 2nd call to the sub, then its a matter of better arranging your code.

    Also, as I mentioned, some things run from VBA outside of Excel cant be properly kept track of in some cases. For example running something via cmd from VBA may not complete before VBA moves on. Sometimes you need to force the code to wait until something is complete that can be validated (ie: loop until file exists, when copying a file from one location to another). How you make it wait depends on the nature of what your doing and how. You can either create code to evaluate a measurable condition and loop until its true/false etc or you can tell VBA to wait X time before moving on which is a bad way to do it as something may take 10 seconds on your computer but 45 on someone elses.

    Without code, samples, error messages, etc we cant really help you with specifics.
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Force User to enable Macros
    By mvassallo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2017, 08:44 AM
  2. Cant hide worksheets after macros to force users to enable macros
    By Mboemoyo85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2015, 02:52 AM
  3. Force other macros to run when a macro is run
    By Nicola13 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-12-2012, 02:18 PM
  4. force enable macros lag
    By FRIEL in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-07-2009, 02:13 PM
  5. Force a new workbook to be readonly with no macros
    By Jlong1980 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-05-2006, 02:49 PM
  6. Macros - Force execution using workbook_open
    By Guy Normandeau in forum Excel General
    Replies: 3
    Last Post: 07-06-2006, 03:35 PM
  7. [SOLVED] Force to enable macros
    By Denys in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2006, 09:30 AM

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