Computer Learning Zone CLZ Access Excel Word Windows

Violence is the last refuge of the incompetent.

-Isaac Asimov
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Excel Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Pivot Tables via Macro
Michael Soprani-Dersch 
    
5 years ago
HI all,

I have the following case:
I have several excel files, which contain pivot tables. These files need to be refreshed regularly. I do not want to do it manually, so I created a code in a separate file.
The code shoule open each of the specified excel, rehresh the pivot table, save and close.
The interesting part is open file not a problem, then the code is:
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
ActiveWorkbook.Close

If you debug step by step all is fine, but if you run the code you get an error between RefreshAll and Save. Reason: The Save command is executed WHILE the pivt table is still refreshing and this generates an error, whereas if you allow the rferhesh t complete, no error.
So, is there a way to tell the system to wait until refrehs is complete, before moving to the Save command?
Alex Hedley  @Reply  
           
5 years ago
What do you have set on

Data > Connections > Properties > enable background refresh
Richard Rost  @Reply  
          
5 years ago
Mac is all you, Alex. :)
Alex Hedley  @Reply  
           
5 years ago
Is it not Mac as in Macro and just the subject got truncated?
Richard Rost  @Reply  
          
5 years ago
Don't I feel silly? :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Excel Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/9/2026 6:02:04 AM. PLT: 0s