open excel 2007 refresh query from batch file

  • Follow


Hello all,

I have a simple script saved as "C:\refresh_excel.vbs" that opens an
Excel file, and does a refresh for a query on Sheet 1. I created a
scheduled task to run this every day.


It worked fine for previous versions of Excel, but since I have
upgraded to Excel 2007 it doesn't work. Any help it helping me figure
this out would be appreciated.


/*contents of refresh_excel.vbs*/
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkBook = objExcel.Workbooks.Open("C:\reports\UPS.xls")
objWorkbook.Sheets("Sheet1").QueryTables(1).Refresh
Wscript.Sleep 6000
objWorkbook.save
objWorkbook.close
objExcel.Quit
0
Reply Brad 6/2/2010 3:50:52 PM


0 Replies
1012 Views

(page loaded in 0.253 seconds)

Similiar Articles:
















7/20/2012 5:43:42 AM


Reply: