Hi all-I've been working on this code for days now and can't seem to figure out how to get it right. Basically what I'm doing is using a website to look up weather data. VBA process is to copy values from worksheet to web page, submit the form to generate a new corresponding value and then paste the value back to worksheet.
Sub WeatherLook()
Dim IE As Object
Dim doc As Object
Dim frm As Object
Dim Ele As Object
Dim Pres As Object
Dim Temp As Object
Dim Humid As Object
Dim BaseURL As String
BaseURL = "http://www.baseballvmi.com/adicalc.php"
Set IE = New InternetExplorerMedium
IE.Navigate BaseURL
Do While IE.Busy: DoEvents: Loop
Do While IE.ReadyState <> 4: DoEvents: Loop
IE.Visible = True
Set doc = IE.Document
Set frm = doc.all("locForm")
Set Ele = doc.all("locElevation")
Ele.Value = ThisWorkbook.Sheets("Team Schedule").Range("K101")
Set Pres = doc.all("locPressure")
Pres.Value = ThisWorkbook.Sheets("Team Schedule").Range("L101")
Set Temp = doc.all("locTemperature")
Temp.Value = ThisWorkbook.Sheets("Team Schedule").Range("M101")
Set Humid = doc.all("locHumidity")
Humid.Value = ThisWorkbook.Sheets("Team Schedule").Range("N101")
frm.submit
ADI = doc.getElementsByClassName("adilarge")(0).innerText
ThisWorkbook.Sheets("Team Schedule").Range("O101") = ADI
End Sub
Everything within the code works fine, except instead of returning the value after submitting the form it returns the original value from the web page.
Any ideas on how to fix this would be greatly appreciated.
Bookmarks