+ Reply to Thread
Results 1 to 2 of 2

Sleep command question

Hybrid View

  1. #1
    Registered User
    Join Date
    09-12-2014
    Location
    Morrisville, NC
    MS-Off Ver
    2013
    Posts
    40

    Sleep command question

    I have a looping macro to print a page for each filtered item in a pivot table. What I'd like to do is add the sleep command to have it wait for about 2 to 3 seconds before it goes to the next item.
    Sub PrintPivotPages()
    'prints a copy of pivot table for
    'each item in page field
    'assumes one page field exists
    On Error Resume Next
    Dim pt As PivotTable
    Dim pf As PivotField
    Dim pi As PivotItem
    Set pt = ActiveSheet.PivotTables.Item(1)
    For Each pf In pt.PageFields
    For Each pi In pf.PivotItems
    pt.PivotFields(pf.Name).CurrentPage = pi.Name
    ' ActiveSheet.PrintOut 'use this for printing
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
    Next
    Next pf
    End Sub
    I'm wanting to slow it down as I had issues with it before of just printing the first value and not going on to the 2nd one, then getting caught in a never ending loop. So I want to slow it down in case I need to stop the macro for any reason.

    Any suggestions?

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Sleep command question

    Take a look at the Application.Wait method
    HTH
    Regards, Jeff

+ 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. sleep diary
    By andy1494 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-17-2015, 05:22 AM
  2. [SOLVED] help with sleep diary
    By andy1494 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2015, 03:23 AM
  3. Can't get no sleep...
    By hatrickx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2013, 07:42 AM
  4. Sleep function
    By Slyone2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 02:36 PM
  5. sleep vs wait
    By ilkamalo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-03-2010, 03:28 PM
  6. Calculating Sleep
    By CarlM in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 08-03-2006, 08:45 AM
  7. Baby Sleep log
    By Baby's Sleep Log in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-02-2006, 03:25 PM

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