Question

I am trying to refresh an excel workbook. There are two sheets that need to be refreshed because they are connected to our database. The workbook is saved as a write only. I can get the workbook to open but I can't get the password to be written and it is the correct password. This is the code I have so far.

Set data = CreateObject("Excel.Application")
data.Visible = True
Set wb = data.Workbooks.Open("C:\Users\tdumas\Desktop\Rental Aerial Agreement    
(TEMPLATE).xlsx", WriteResPassword="lift123456")_
ReadOnlyRecommended=False
IgnoreReadOnlyRecommended=True
data.ActiveWorkbook.RefreshAll
WScript.Sleep(SecondsToWait * 5000)
data.ActiveWorkbook.Save
wb.Close
data.Application.Quit 

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top