我正在构建一个工作表并尝试将机场的 TAF(预测)输出到 Excel 中的单元格 B7 中。调试器不断标记 request.Open 行并显示错误消息“URL 未使用可识别的协议”。欢迎任何建议。
Sub InitializeTAF()
Dim url As String
Dim request As New WinHttpRequest
Dim response As String
Dim ids As String
Dim format As String
' Set the TAF data request parameters
ids = "RKSO"
format = "raw"
' Construct the request URL
url = "https://www.aviationweather.gov/taf/data?ids=RKSO&format=raw&date=&submit=Get+TAF+data" & format & "&stationString=" & ids
' Send the request and get the response data
request.Open "GET", url = "https://www.aviationweather.gov/taf/data?ids=RKSO&format=raw&date=&submit=Get+TAF+data", False
request.Send
response = request.ResponseText
' Update the TAF display with the new data
ActiveSheet.Range("B7").Value = response
' Refresh the TAF display every 2 minutes
Application.OnTime Now + TimeValue("00:02:00"), "InitializeTAF"
End Sub
我试过在 request.open 行上使用 url = http://,它仍然给了我同样的错误。前面提到的宏的预期结果是将 TAF 的行输出到我的活动工作表上的单元格 B7 中。