The NOAA site you refer to offers the data in an XML format. IIt appears that the URL to navigate to the XML version of the data employs the Lat/Long coordinates of the location you're after.
I used the location you had in your example and retrieved the XML data into a string variable using an XMLHTTP request. From there, you can parse it down to retrieve the elements you need to capture into a spreadsheet.
Here's a rough example to get you started. Works very fast. No need to employ Internet Explorer automation.
Public Sub getNOAA_XML()
Dim xmlhttp As Object
Dim myxml As String
Dim strURL As String
Dim strMyTimes As String, arrMyTimes()
Dim strMyTemps As String
Dim temps As Variant
Dim n As Integer
Dim regexp As Object
Dim times As Object
strURL = "http://forecast.weather.gov/MapClick.php?lat=38.89500&lon=-77.03730&FcstType=digitalDWML"
Set xmlhttp = CreateObject("microsoft.xmlhttp")
With xmlhttp
.Open "get", strURL, False
.send
x = .responsetext
End With
strMyTemps = Mid(x, InStr(1, x, "<temperature type=""hourly"""))
strMyTemps = Mid(strMyTemps, InStr(1, strMyTemps, "<value>"))
strMyTemps = Mid(strMyTemps, 1, InStr(1, strMyTemps, "</temperature>"))
strMyTemps = Replace(strMyTemps, "<value>", "")
temps = Split(strMyTemps, "</value>")
strMyTimes = Mid(x, InStr(1, x, "<start-valid-time>"))
strMyTimes = Mid(strMyTimes, 1, InStr(1, strMyTimes, "</time-layout>"))
Set regexp = CreateObject("vbscript.regexp")
With regexp
.Global = True
.Pattern = "<start-valid-time>(.+)</start-valid-time>"
Set times = .Execute(strMyTimes)
End With
If times.Count = UBound(temps) Then
ReDim arrMyTimes(times.Count)
For n = 0 To times.Count - 1
arrMyTimes(n) = times(n).submatches(0)
Next n
With ActiveSheet
.Range("a1").Resize(UBound(arrMyTimes), 1) = WorksheetFunction.Transpose(arrMyTimes)
.Range("b1").Resize(UBound(temps), 1) = WorksheetFunction.Transpose(temps)
End With
Else
MsgBox "error"
End If
Set xmlhttp = Nothing
Set regexp = Nothing
End Sub
.
Bookmarks