Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Problem

Status
Not open for further replies.

DBSSP

Programmer
Apr 1, 2002
327
US
I need some help here. I have this macro that opens excel to run a macro. The excel macro goes to update via a RefreshAll command then saves and closes Excel. My problem is that it wont wait until the refresh is done. It interuppts with the save command and that's all she wrote. No updates. Any ideas on how to correct this?

Here is my code:
*************************************************************
Access Code
*************************************************************

Function UpdateRatio()

Dim XL As Excel.Application
Set XL = New Excel.Application

XL.Workbooks.Open "workbook path.xls"
XL.Application.DisplayAlerts = False
XL.Run ("Update")
Set XL = Nothing
MsgBox "Updates completed successfully!", vbOKOnly, "Update Success"

End Function

*************************************************************
Excell Macro Code
*************************************************************
Sub Update()

ActiveWorkbook.RefreshAll

Excel.Run "Save"
Excel.Run "Quit"

End Sub
**************************************************************

I orginally had the save and quit functions bundled into this macro, but I seperated them to try to correct my timing issue. Any help would be greatly appreciated.

Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top