VBA IE Automation Logon, Navigate multiple buttons and then scrape data back into excel


New Member
Jan 30, 2014
Hello All,

I am having trouble with some VBA to scrape data. I have a website (FltPlan.com) that I need to login to (I have managed to find multiple sources of code to do this and it seems pretty straight forward. Once logged in I need to navigate to a specific page on the site to scrape some data. I think the problem lies in that the links to navigate are not links but instead are buttons. It will become readily apparent by my example code that I am a novice with VBA. Here is the code I started with:

VBA Code:
Sub followWebsiteLink()

Dim IE As InternetExplorer
Dim html As HTMLDocument
Dim link As Object
Dim ElementCol As Object
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject

    Application.ScreenUpdating = False

    Set IE = New InternetExplorer
    IE.Visible = True

        IE.Navigate "https://fltplan.com"

        Do While IE.ReadyState <> READYSTATE_COMPLETE
           Application.StatusBar = "Loading website…"
                Set html = IE.Document
        Set ElementCol = html.getElementsByTagName("a")
            'fill in the login form – View Source from your browser to get the control names
    With IE.Document.forms(0)
        .UserName.Value = "IDFLT"
        .Password.Value = "12345678"
          Do While IE.Busy: DoEvents: Loop
    Do Until IE.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
    End With


        For Each link In ElementCol
        If link.innerHTML = "Flight Planning" Then
        End If
        Next link
        Set IE = Nothing
        Application.StatusBar = ""
        Application.ScreenUpdating = True

End Sub

Once logged into the site I want to click the bototn labeled. "Flight Planning" when clicked that expands a list of links/buttons. Once expanded I need to click "Flight Listing". That opens the page I need to scrape data from and paste into excel.

I know that this is setup incorrectly after the initial logging in but I am having trouble searching and finding a solution to navigate and then scrape the data. If anyone knows of an example they could point me to or has some expertise they might lend I would appreciate it.

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Watch MrExcel Video

Forum statistics

Latest member