Unable to Refresh OLEDB connection from vbScript

The goal is to have Visual Basic script refreshing the external data of an xlsm file.

The script runs without errors, but afterwards, nothing has happened to the xlsm file. It seems like the script continuous before all the data has been refreshed.

I've tried a few things already.

Here is the script's content:

Option Explicit

Dim xlApp, xlBook

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("name_of_my_file.xlsm")

xlBook.RefreshAll
WScript.Sleep 1800000

xlBook.Save
xlBook.Close
xlApp.Quit

Set xlBook = Nothing
Set xlApp = Nothing

WScript.Echo "Finished test v2, i.e. refreshing data"
WScript.Quit

Upvotes: 0

Views: 42

Answers (0)

Related Questions