none
Excel VBA to Automate Internet Form Filling RRS feed

  • Question

  • Hi, 

    I wonder if this is possible to automate Internet Form Filling by Excel VBA. Like I have a database which usually have same data each month. Some small things change but that can be defined by some formula of excel. The Internet form that I have has login page, and as that has some steps, i want to do that manually and then I want to fill step by step forms by taking data from excel. and finally it will submit. Is it possible? The form doesnt only contain text but selecting from many options. 

    Waiting for your reply.

    Shuvo 

    Saturday, May 6, 2017 7:24 PM

All replies

  • Yes, you can do all of that.  Can you share the URL, or is this an internal intranet thing?  Either way, the script would probably start like this.

    Dim IE As InternetExplorer
    Dim myZip As Long
    Dim siteZip As Object
    Dim URL As String
    Dim gender As Object
    Dim btnGo As Object
    
    Sub Macro_1()
    myZip = "12345"
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True
    URL = "Individual and Family Health Insurance"
    IE.navigate (URL)
    
    Do
    DoEvents
    Loop Until IE.readyState = 4
    
    Set siteZip = IE.document.getElementById("census_zipCode")
    siteZip.Value = myZip
    
    Set gender = IE.document.getElementById("census_primary_gender")
    gender.Value = "MALE"
    
    Set btnGo = IE.document.forms(0).all("method:submit") ' method:submit is the button's name
    btnGo.Click
    
    End Sub

    https://www.mrexcel.com/forum/excel-questions/709346-clicking-button-via-ie-automation-visual-basic-applications.html


    MY BOOK

    Sunday, May 7, 2017 4:13 AM