Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
formulas continuing | Excel Worksheet Functions | |||
How To Finish pivot table refresh before cont. VBA code | Excel Programming | |||
continuing code on another line? | Excel Programming | |||
VBA code to finish this form, Thanks | Excel Programming | |||
Continuing print code problem | Excel Programming |