ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Parameter in a web query (https://www.excelbanter.com/excel-programming/423449-re-parameter-web-query.html)

joel

Parameter in a web query
 
MyDate = Application.InputBox(prompt:="Enter Date", Type:=2)
If IsDate(MyDate) Then
StrDate = Format(MyDate, "YYYYMMDD")


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.nba.com/schedules/index.html?gamedate=" & StrDate, _
Destination:=Range("A1"))
.Name = "index.html?gamedate=" & StrDate
.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 = """scheduleTable"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Else
MsgBox ("Bad Date")
End If

"Jai" wrote:

I am currently running web query to retrieve a table from the NBA website using
http://www.nba.com/schedules/index.h...edate=20090205 ,
where the date at the end changes from day to day. I have no idea how to use
a parameter for a web query. Would greatly appreciate any help anyone can
provide. Thanks, Jai



All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com