'---------------------------------------------------------------------------------------
' Procedure : Wunderground
' Author : Jack
' Date : 11/5/2013
' Purpose : Using Wunderground link, get a 10 day forecast or airport YOW (ottawa, ON, Canada)
'
' see http://www.access-programmers.co.uk/forums/showthread.php?t=240796
' There was other info on UtterAccess, but uses excel...
' see http://www.utteraccess.com/forum/Pull-Data-Website-t1999204.html
'---------------------------------------------------------------------------------------
'
Sub Wunderground()
Dim MyKey As String
10 MyKey = "1e197398857b6741" ' I got this key May 11 2013 JED
Dim Req As New XMLHTTP
Dim Resp As New DOMDocument
Dim Weather As IXMLDOMNode
20 Req.Open "GET", "http://api.wunderground.com/api/" _
& MyKey _
& "/hourly10day/q/CA/Yow.xml", False
30 Req.send
40 While Req.Status <> 200
50 Debug.Print "waiting for response*** info"
60 DoEvents
70 Wend
80 Resp.loadXML Req.responseText
90 Debug.Print Resp.xml
100 For Each Forecast In Resp.getElementsByTagName("forecast")
110 Debug.Print Forecast.SelectNodes("FCTTIME")(0).SelectNodes("pretty")(0).text
'Debug.Print Forecast.SelectNodes("FCTTIME")(0).SelectNodes("hour")(0).text
120 Debug.Print "Temp C: " & Forecast.SelectNodes("temp")(0).SelectNodes("metric")(0).text
130 Debug.Print "Condition: " & Forecast.SelectNodes("condition")(0).text
140 Debug.Print
150 Next
End Sub