Good afternoon, I am trying to connect excel to web query but it is not working. I created this in VbScript. Here is my code below:
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.visible = False
objExcelApp.Workbooks.Open strExcelFile
With objExcelApp.ActiveSheet.QueryTable.Add("URL;file://serverName/fileName.html", objExcelApp.ActiveSheet.Range("A1"))
.Name = "Test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = 1
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
End With
objExcelApp.ActiveWorkbook.Save
objExcelApp.Quit
Set objExcelApp = Nothing
Msgbox "Done"
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.visible = False
objExcelApp.Workbooks.Open strExcelFile
With objExcelApp.ActiveSheet.QueryTable.Add("URL;file://serverName/fileName.html", objExcelApp.ActiveSheet.Range("A1"))
.Name = "Test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = 1
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
End With
objExcelApp.ActiveWorkbook.Save
objExcelApp.Quit
Set objExcelApp = Nothing
Msgbox "Done"