ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vbscript question... (https://www.excelbanter.com/excel-programming/319694-vbscript-question.html)

rosen

vbscript question...
 
If I want to perform a data base update (i.e. same as hitting "!" in
the UI) from a vbscript what command should I use....

SpreadSheet = "D:\test.xls"

' Create the Excel application object
Dim Excel
Set Excel = CreateObject ("Excel.Application")
Excel.Visible = True

Excel.Workbooks.Open SpreadSheet

Excel.Refresh <---- This is giving me an error
Excel.Workbooks.Close
Excel.Quit


Dave Peterson[_5_]

vbscript question...
 
This seemed to work ok.

SpreadSheet = "D:\test.xls"
Dim Excel
dim Wkbk

Set Excel = CreateObject ("Excel.Application")
Excel.Visible = True

set wkbk = Excel.Workbooks.Open (SpreadSheet)

wkbk.RefreshAll
wkbk.Close true 'save changes???
Excel.Quit

set wkbk = nothing
set excel = nothing

===============
Did you want to save your changes?



rosen wrote:

If I want to perform a data base update (i.e. same as hitting "!" in
the UI) from a vbscript what command should I use....

SpreadSheet = "D:\test.xls"

' Create the Excel application object
Dim Excel
Set Excel = CreateObject ("Excel.Application")
Excel.Visible = True

Excel.Workbooks.Open SpreadSheet

Excel.Refresh <---- This is giving me an error
Excel.Workbooks.Close
Excel.Quit


--

Dave Peterson


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com