+ Reply to Thread
Results 1 to 7 of 7

Problem with wait/sleep

  1. #1
    Registered User
    Join Date
    05-14-2007
    Posts
    4

    Problem with wait/sleep

    Hi all,

    I've recorded an excel macro which basically just opens up an excel file does a "Refresh All" saves and shuts itself. Problem I'm having is that the "Refesh All" command doesn't have time to finish before the macro tries moving on to the next step.

    I'd like to get my macro to sleep for X seconds so the "Refresh All" can finish.

    I am using Excel 2007.


    Here is my current macro :

    Please Login or Register  to view this content.

    Regards,

    John Gillespie
    Last edited by johngillespie; 05-14-2007 at 08:50 AM.

  2. #2
    Registered User
    Join Date
    05-14-2007
    Posts
    4
    I have tried using this method (http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx) but it pauses the Refresh all command

  3. #3
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    Is this what your looking for?

    Please Login or Register  to view this content.
    The code will wait for 5 seconds.

    HTH,
    mccreaso

  4. #4
    Registered User
    Join Date
    05-14-2007
    Posts
    4
    Quote Originally Posted by mccreaso
    Is this what your looking for?

    Please Login or Register  to view this content.
    The code will wait for 5 seconds.

    HTH,
    mccreaso
    I have tried that and it doesn't work since the Refresh command gets paused too What I need is something that lets the Refresh command to run whilst pausing the rest of the macro.

  5. #5
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    Split it into 2 macros and use the Application.OnTime function:

    Macro1
    Please Login or Register  to view this content.
    Macro 2

    Please Login or Register  to view this content.
    Havent tested it, but hope it helps,

    mccreaso

  6. #6
    Registered User
    Join Date
    05-14-2007
    Posts
    4
    worked like a charm, thanks a lot !

  7. #7
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    Glad it helped !
    mccreaso

+ 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