Hi,
I am trying to create a web query for a web site that has pages like
website.com/page1
website.com/page2
...
I started with the following code
I want the macro to get "page1" text from a cell, namely A1. So, that when I change the value in cell A1 and run the macro, I can get a query for another page. Any ideas?
I am trying to create a web query for a web site that has pages like
website.com/page1
website.com/page2
...
I started with the following code
Code:
Sub GetData()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.website.com/page1", Destination:=Range( _
"$G$2"))
.Name = "page1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
I want the macro to get "page1" text from a cell, namely A1. So, that when I change the value in cell A1 and run the macro, I can get a query for another page. Any ideas?