SonofRed
04-13-2014, 09:22 AM
Dear all,
I am a beginner at VBA and i am recently working on making a flight and flight status lookup. However, i am stuck on grabbing the status data, shown as below highlighted data:
11562
I have tried various set of codes, however i just cant manage to get the one i want. Can anyone pls provide me some advice. Thanks everyone!
Here are the codes i am using right now:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = Range("Flight").Row And _
Target.Column = Range("Flight").Column Then
Dim IE As New InternetExplorer
IE.Visible = True
IE.navigate "URLlink" & Range("Flight").Value
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim sTD As String
sTD = Trim(Doc.getElementById("list").getElementsByTagName("td")(4).innerText)
MsgBox sTD
End If
End Sub
I am a beginner at VBA and i am recently working on making a flight and flight status lookup. However, i am stuck on grabbing the status data, shown as below highlighted data:
11562
I have tried various set of codes, however i just cant manage to get the one i want. Can anyone pls provide me some advice. Thanks everyone!
Here are the codes i am using right now:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = Range("Flight").Row And _
Target.Column = Range("Flight").Column Then
Dim IE As New InternetExplorer
IE.Visible = True
IE.navigate "URLlink" & Range("Flight").Value
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim sTD As String
sTD = Trim(Doc.getElementById("list").getElementsByTagName("td")(4).innerText)
MsgBox sTD
End If
End Sub