Automatize a navegação e a coleta de dados do IE com o Excel VBA

0

I am trying to navigate Interent Explorer and Download a CSV with VBA. I know the site is coded in html with javascript, but I am struggling finding the point where I need to use VBA syntax for javascript instead of html. I also don't know if this is the correct way to do this as the documentation, I have found, online is not specific to cover my specific issue. I understand that I could perform this with python fairly easily, but lack the knowledge to begin that journey. Starting with VBA even if it's slow.

Below is my current attempt and first attempt at coding the automation. Also if there is any way anyone knows to schedule a macro to run when the OS is "locked" not "logged out" this would be excellent, but for now I really just need a automated way to grab this data.

Public Sub GrabCSV()

    Dim IE As InternetExplorerMedium
    Dim URL As String
    Set IE = New InternetExplorerMedium
    URL = "http://link"
    With IE
        .Visible = True
        .Navigate URL
    End With

    Do While IE.Busy
        DoEvents
    Loop

    'Current Attempt
    IE.document.form.Select.getElementsByName("01").Selected = True
    IE.document.form.Select.getElementsByName("02").Selected = True
    IE.document.form.Select.getElementsByName("03").Selected = True

    'Attempt 1
    'IE.Document.form("highlight").Select
    'IE.Document.(getElementsByTagName("option").selectedIndex = 1

    'ListBox? - Line Selection
    'Click "Get Dates for All ToolCodes..."
    'Date Selection - 'From Date' and 'To Date'
    'Click "Downtime Report"
    'Click Radio button By Line,Date,DT Code
    'Click "Download Report"
    'Download .csv to folder

End Sub

I posses the source code for the website I am attempting to navigate. I just can't seem to post it with out the html formatting taking it (omitting the important items). I will add a link to a share file here.

The selections are to be "Furnace 1 , 2 , 3" and Date Range "10-3-2017" to "4-18-2018". I need to download the data in a CSV file for excel as I have other macros that process that CSV and distribute its contents to various files.

    
por Loading... 19.04.2018 / 21:25

0 respostas