Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default Finish one section of code before continuing

I'm trying to Auto_run a macro in a different workbook that opens an existing file, refreshes the pivot table, saves, then closes excel completely. My only problem is that my code trys to close excel before the refresh is complete. How can I tell it to finish the refresh operation before continuing?

THANKS!!!

ChDir "T:\Data\"
Workbooks.Open Filename:= _
"T:\Data\file.xls"
ActiveSheet.PivotTables("PivotTable1").RefreshTabl e
ActiveWorkbook.Save
ActiveWindow.Close
Set excelApp = GetObject(, "Excel.Application")
excelApp.Quit
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Finish one section of code before continuing

You might try

DoEvents

before ActiveWorkbook.Save

"graham" wrote:

I'm trying to Auto_run a macro in a different workbook that opens an existing file, refreshes the pivot table, saves, then closes excel completely. My only problem is that my code trys to close excel before the refresh is complete. How can I tell it to finish the refresh operation before continuing?

THANKS!!!

ChDir "T:\Data\"
Workbooks.Open Filename:= _
"T:\Data\file.xls"
ActiveSheet.PivotTables("PivotTable1").RefreshTabl e
ActiveWorkbook.Save
ActiveWindow.Close
Set excelApp = GetObject(, "Excel.Application")
excelApp.Quit
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Finish one section of code before continuing

OR:

while application.calculationversion < activeworkbook.calculationversion


"AA2e72E" wrote:

You might try

DoEvents

before ActiveWorkbook.Save

"graham" wrote:

I'm trying to Auto_run a macro in a different workbook that opens an existing file, refreshes the pivot table, saves, then closes excel completely. My only problem is that my code trys to close excel before the refresh is complete. How can I tell it to finish the refresh operation before continuing?

THANKS!!!

ChDir "T:\Data\"
Workbooks.Open Filename:= _
"T:\Data\file.xls"
ActiveSheet.PivotTables("PivotTable1").RefreshTabl e
ActiveWorkbook.Save
ActiveWindow.Close
Set excelApp = GetObject(, "Excel.Application")
excelApp.Quit
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formulas continuing crtreporter Excel Worksheet Functions 1 April 13th 07 08:16 PM
How To Finish pivot table refresh before cont. VBA code graham Excel Programming 0 June 24th 04 06:22 AM
continuing code on another line? neowok[_49_] Excel Programming 9 April 16th 04 11:46 AM
VBA code to finish this form, Thanks Don Guillett[_4_] Excel Programming 1 January 14th 04 03:22 PM
Continuing print code problem Stuart[_5_] Excel Programming 0 August 5th 03 06:54 PM


All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"