'VSB relative path clashes with "refresh all"
I built a vbs script which "refresh all" and save a Master Workbook. The workbook contains many sheets and most of the sheets have queries linked to other workbooks. The VBS script, the Master workbook and the many workbooks are all in the same folder (D:\TEST).
VBS script is simple:
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open( fullpath & "\Master_Workbook.xlsx")
objExcel.ActiveWorkbook.RefreshAll
objExcel.ActiveWorkbook.Save
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.Close False
objExcel.Application.Quit
If the path to the Master_Workbook.xlsx is hardcoded, all is fine. The issue is when using "fullpath & ". The "refresh all" does not work anymore. I have the error message:
[DataSource.Error] Could not find file 'C:\Users\my-username\Documents\workbook1.xlsx'
While all the files are in D:\TEST folder
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
