EXCEL WEB QUERY


 

A basic VBA codes that can be used to perform a simple web query and extracting it to an excel spreadsheet from ATO website.

Sub Basic_Web_Query()

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://www.ato.gov.au/Business/Small-business-benchmarks/In-detail/Benchmarks-A-Z/A-C/Air-conditioning,-refrigeration-and-heating-services---issued-2014/", _
Destination:=Range("$A$1"))
.Name = "q?s=goog_2"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1,2,3,4,5,6,7,8,9"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

End Sub

Leave a Reply


*