Automate Internet Explorer with Excel VBA Part 3- Automatic web form filling

Share
Embed
  • Published on Jul 31, 2016
  • Support Amarindaz on Patreon: goo.gl/it9Gpk --~--
    Title: Automate the webform filling or data entry work from Internet Explorer using Excel VBA
    Visit My Blog: www.amarindaz.com
    Are you beginner to Excel VBA ? Check out my ebook: www.amarindaz.com/go/excel-vba/
    Recommended Excel VBA books
    ===================================================
    www.amarindaz.com/go/excel-vba-24-hour-trainer/
    www.amarindaz.com/go/excel-2016-power-programming-vba/
    www.amarindaz.com/go/excel-2013-power-programming-vba/
    ====================================================
    Facebook page: facebook.com/amarindaz
    Source Code for this Video: goo.gl/zZuaBV
    Website Link:newtours.demoaut.com/mercuryregister.php

    In this video, you'll learn how to
    ======================================================
    1)How to launch internet explorer with Excel VBA
    2)How to navigate to webpage using VBA
    3)Wait until the browser gets loaded
    4)How to identify the webelement to automate the form filling work
    5)How to locate weblement and create object for webelement in VBA
    6)How to pass value or text to webelement textbox in VBA
    7)How to handle dropdown in webpage using excel VBA
    8)How to submit the web form from VBA
    ======================================================

Comments • 67

  • Bangladeshi Recreation

    sir please help me!!!!
    help me sir i need your help
    docs.google.com/document/d/1ldJPw2VLPx2Q7jiJoVCMMnvN7pjev5esZkxX-_3RXfU/edit?usp=sharing
    please see this....

  • Farid Mauricio Chavarro Montaño

    I could not get the name of the user's box and password, as the page says is "login" and "password", but it does not give me, you can help me please, thank you very much.
    web.zurichseguros.com.co/zcc-web-app/login

  • CalmBeans
    CalmBeans 2 months ago

    What references need to be active for this subroutine to work. So far I have enabled "Micorsoft Internet Controls" but I am still getting a "Run-time error '13': Type mismatch" when the subroutine reaches "Set fname = doc.getElementById("firstName")
    fname.Value = "First Name""Any ideas?

  • Dildar Corbett
    Dildar Corbett 3 months ago

    Sir one chalange for you.plz fill this webside form automaticly
    www.corbettonline.uk.gov.in

  • Manorama Dey
    Manorama Dey 3 months ago +1

    Finally I found something what I need .. Tx

  • cenAtion Rko
    cenAtion Rko 4 months ago

    what if i dont want to open new window each time i run the macro, i just want to fill data in already opened window please help awesome video

  • Vipin Thakur
    Vipin Thakur 4 months ago

    DEAR SIR,
    EVERYONE AUTOMATE INTERNET EXP.. WITH EXCEL VBA. NOBODY CAN DO WITH GOOGLE CHORME & FIREFOX
    SO PLEASE UPLOAD THE WITH GOOGLE CHORME & FIREFOX

  • MD. Shamim
    MD. Shamim 6 months ago

    I use a Excel data file which carry 100 rows and 16 columns, There the Mother's name, the Father's name e.t.c and a Picture. When my data Automatically Fill a web from using VBA coding, I want to know how to add Automatically the picture in the from. what is the code??? Help me please

  • Mr Singh
    Mr Singh 7 months ago

    i have one question about login button when i inspect element on login button there is no id show then how would i connect through vba.

  • Roshan kumar
    Roshan kumar 8 months ago +1

    How to enter user ID example in zerodha automatically there is no name and ID to copy.. Then how write vba

    • Amarindaz
      Amarindaz  8 months ago

      We can automate with other attributes like class name , Tag name but java has more functions to automate web app

    • Roshan kumar
      Roshan kumar 8 months ago

      +Amarindaz how to code it in vba.. Without element Id or name..we can't do automate through vba for that we have to learn java..?

    • Amarindaz
      Amarindaz  8 months ago

      You can use selenium to automate such a website. Check out my playlist for selenium tutorial :)

  • dwad wadawd
    dwad wadawd 10 months ago

    Love you! Made my work 90% faster :)

  • hiren doshi
    hiren doshi 11 months ago

    Hello it's very good and useful for me thanks for video.
    But I have thousand of data in excel can you help me to solve out data enter in Web form from excel with all data one by one fill in Web form with only one click kindly help me to do. ....

  • Zainab D
    Zainab D 11 months ago

    Hi, I have tried and tested to unlock an excel workbook which is password protected by my ex colleague but I have failed multiple times. I saw your video on how to unlock VBA Project and Macro code but it did not help either after reaching the VBproject.bin I do not get an option of "Open with" so cannot move to the next step. I tried to open the file direct from HEX editor but was not able to do so...
    Can you help me as its our quality grading sheet and i need to unlock the password to make changes on the sheet
    Can u give ur email ID to communicate further?

  • Rajeev kumar singh
    Rajeev kumar singh Year ago +1

    Hi sir please tell me using VBA how save the multiple forms in the end if we uploaded it online

  • Martin Rajith
    Martin Rajith Year ago +1

    INSTEAD OF INTERNET EXPLORER .CAN WE BROSWE IN GOOGLE CHROME?

    • Amarindaz
      Amarindaz  Year ago

      You can do with selenium plugin installed on your excel

  • Lin-Shen Miao
    Lin-Shen Miao Year ago

    Sub automaticformfilling()
    Dim ie As InternetExplorer
    '
    Dim doc As HTMLDocument
    '
    Set ie = CreateObject("internetexplorer.application")
    With ie
    .Visible = True
    .navigate "newtours.demoaut.com/mercuryregister.php"
    'Wait for loading
    Do While .Busy
    DoEvents
    Loop
    Do While .readyState 4
    DoEvents
    Loop
    End With
    Set doc = ie.document
    '
    Set fname = doc.getElementById("firstName")
    fname.Value = "First Name"

    Set lastName = doc.getElementById("lastName")
    lastName.Value = "Last Name"

    Set phone = doc.getElementById("phone")
    phone.Value = "54646346"

    Set UserName = doc.getElementById("userName")
    UserName.Value = "test@gmail.com"

    Set address1 = doc.getElementById("address1")
    address1.Value = "Add 1"

    Set address2 = doc.getElementById("address2")
    address2.Value = "Add 2"

    Set city = doc.getElementById("city")
    city.Value = "Tim"

    Set State = doc.getElementById("state")
    State.Value = "Iowa"

    Set postalCode = doc.getElementById("postalCode")
    postalCode.Value = "45345"

    Set country = doc.getElementById("country")
    For i = 1 To country.Options.Length
    If country.Options(i).Text = "INDIA" Then
    country.selectedIndex = i
    Exit For
    End If
    Next i
    Set Email = doc.getElementById("email")
    Email.Value = "test@gmail.com"

    Set Password = doc.getElementById("password")
    Password.Value = "pwd@123"
    Set confirmPassword = doc.getElementById("confirmPassword")
    confirmPassword.Value = "pwd@123"
    doc.forms(0).submit
    End Sub

  • Arun Vikraman
    Arun Vikraman Year ago

    Nice video... I have a captcha image in login screen.. how can I bypass it.. the data entry page is available only after login with proper credentials.. any way around???

    • ɿɐq ɿɾɐɿɐq
      ɿɐq ɿɾɐɿɐq Year ago

      unfortunately, even a simple 2D captcha would need complicated text recognition code to be built-in into a software for this purpose. most use the same, proprietary (but open-source nowadays) acrobat text recognition feature but there are other ways to generate text from an image that can be 'google'd. even worse, excel does not have any text recognition coding built-in, hence, the only option is to use a third party software. de-captcher.com might give you some ideas.

  • Dunia Fatamorgana

    How if the data is in excel table, must input to web browser ?
    BALAS

  • chennai super kings

    how to auto upload online form filling by excel sheets the web page has login id and password at the beggining

  • mauricio preve
    mauricio preve Year ago

    Why is the 13 code error ? for the code you posted

  • Los Chauchas
    Los Chauchas Year ago

    thanks for the video, but is there any way I can put some data that I want and then refresh the page and put other different data and so all the time?

    • Amarindaz
      Amarindaz  Year ago

      Yes you can. Just use for loop and
      Dim ie As New InternetExplorer
      ie.Refresh
      will do the refresh

  • Pairozkhan gorekhan
    Pairozkhan gorekhan Year ago +1

    plz codeing sir

  • Day to Data Inc.
    Day to Data Inc. Year ago +1

    Great tutorial! Thanks

  • sachin singh
    sachin singh Year ago +1

    Really very useful tutorial... Thanks and great job

  • Prakash Praaku
    Prakash Praaku Year ago +1

    This video is truely informative. Thank you sir.
    Can we automate to upload a pdf document to a specific website using VBA sir ??
    if so please upload a video on that, it will really help us a lot.
    Thanks in advance,
    Prakash GS

  • Sushil Chaudhari
    Sushil Chaudhari Year ago

    Worth to watch!!! Thanks for sharing such a nice tutorials

    • Amarindaz
      Amarindaz  Year ago

      +Sushil Chaudhari you're welcome

  • karthik veeram
    karthik veeram Year ago

    how to link outlook with web based application ..

  • hemanthmaharana
    hemanthmaharana Year ago

    Hi Amarind Thanks so much for making this video. I have one query about in internet explorer how write code for "clicking" any option in web page...

  • Ganesh Elumalai
    Ganesh Elumalai Year ago

    how to select / click the radio button in web page using vba code? for example yes or no !!! Can you help me out ?

  • Pritam Patel
    Pritam Patel Year ago

    can you help to fill the web form from a set of excel data

  • Tirumal Sharma
    Tirumal Sharma Year ago +1

    This Is what make us believe in Web Tutorial!!!!...cARtloads of thanks respect and gratitude

    • Amarindaz
      Amarindaz  Year ago

      +Tirumal Sharma glad to hear :)

  • Ashish Goyal
    Ashish Goyal Year ago

    can I run this script on an already opened web page, instead of a new webpage ? Please help.
    Like for example, www.gmail.com is already opened, and I just want to gain control over the already opened page, instead of opening a new page all together.

    • Arun Vikraman
      Arun Vikraman Year ago

      Ashish Goyal did you find a way around?? If so pls help

  • Amit Bodhwani
    Amit Bodhwani 2 years ago

    Hi,
    There is a text box on my webpage which on clicking will pop up a calendar the properties of that text box is

    I tried clicking that button using IE.document.getelementbyid("datepicker") and IE.document.getelementsbyclassname("hasDatepicker") and also IE.document.getelementsbyname("date") but i failed everytime and i am not able to click text box because of which the calendar on my webpage is not appearing.
    I tried using Selenium Java code and it is working fine with it but i want to code with VBA scripting.
    Please help me with this issue as while running i am not getting any errors also.
    Thank You

  • Cleiton da Silva Leal
    Cleiton da Silva Leal 2 years ago +1

    thx so much
    muito obrigado

  • Mohammed Mushtaq
    Mohammed Mushtaq 2 years ago

    Run time error '13':
    Type mismatch
    Please advise Why am getting this error?

  • RAVI ROSHAN
    RAVI ROSHAN 2 years ago

    why this doesnt work properly ie.document.getelementbyid("q").value = "some text" after running the code several times it works once and does its work and then stops working again. can you help?

  • Gazi Dawan
    Gazi Dawan 2 years ago

    Thank you sir, Amarindaz for Nice Tutorial.

  • Nandeeswara Raju Kondur

    I need to click a hyperlink image after launching my webpage.
    Could you please help me how to achieve that..
    Hyperlink image code looks like
    "
    "

  • Prasanth Rajagopal
    Prasanth Rajagopal 2 years ago +1

    Thanks Amarindaz. Its really helpful.

    • Sadik Tamboli
      Sadik Tamboli 2 years ago

      Amarindaz hii provide me email id I have something to discuss with you

    • Amarindaz
      Amarindaz  2 years ago

      +Prasanth Rajagopal you're welcome

  • CSVspb
    CSVspb 2 years ago +1

    Thank you for this video. I had one problem, but i saw decision in this video=)

  • Muhammad Aneel Aslam
    Muhammad Aneel Aslam 2 years ago

    What code auto enter Category in adsolutions.yp.com/listings/basic
    and submit button code?

  • Manuel Ruthardt
    Manuel Ruthardt 2 years ago +2

    Hi, thank you for the video. I really like these kind of tutorials. I tried to run your code myself but at the line:
    "Set fname = IE.document.getElementById("firstName")"
    I get the following Error:
    Run-time error '13': Type mismatch
    I cannot figure out why. This for example works "IE.document.all.Item("firstName").Value = "TestValue" but I would like to understand why yours doesnt seem to work for me.
    If anyone has an Idea let me know.

    • Sreekanth Konangi
      Sreekanth Konangi 5 months ago

      Sub automaticformfilling1()
      Dim ie As Object
      Dim objectelement As Object
      Dim c As Integer
      Dim i
      Dim strCaptcha As String
      Dim strImageSource As String
      Dim img As HTMLHtmlElement

      Set ie = CreateObject("InternetExplorer.Application")

      With ie
      .Visible = True
      .navigate "newtours.demoaut.com/mercuryregister.php"

      Do Until .readyState = 4
      DoEvents
      Loop
      End With
      With ie.document

      .all("firstName").Value = "First Name"
      .all("country").Item(107).Selected = True

      End With
      Set ie = Nothing

      End Sub

    • mauricio preve
      mauricio preve Year ago

      Did you have the answer for it?

    • Mohammed Mushtaq
      Mohammed Mushtaq 2 years ago +1

      Even I am also getting the same error!

    • Surya
      Surya 2 years ago

      I have the same error - Some help please

  • Himanshu Kumar Singh
    Himanshu Kumar Singh 2 years ago

    Need you help

  • Himanshu Kumar Singh
    Himanshu Kumar Singh 2 years ago

    Hi Amarindaz, as i told you about my problem on your other post just now, i will explain that problem now- in the above video while filling dropdown of country you have given diff.code as compared to others. So, the form which i want to fill has more tha 2 drop downs. If i am selecting X in dropdown 1 then i have diff. options in dropdoown 2 like X1, X2, X3, etc.
    So i am able to fill the first dropdown but not able to fill the 2nd dropdown. What should i do now, any solution for this??

    • Himanshu Kumar Singh
      Himanshu Kumar Singh 2 years ago

      I dont know but its not working for me, can you please check whatever code you have given is correct or not??

    • Amarindaz
      Amarindaz  2 years ago

      I understood what you are trying to say. Your second drop down options are varying based on the option you selected from the first drop down.In this case, you should create a mapping for each option in the drop down 1 and note it down for your reference. For e.g Y1,Y2 are the two options in the drop down 1, when you select Y1 it'll show X1 and x2 in drop down 2 and when you select Y2 it'll show X3 and X4 in drop down 2. Let's say you want to select Y2 in drop down 1 and X3 in drop down 2 then your code should be like this
      gist.github.com/erajanraja24/98653373582ff54403882da7c54d5576#file-drop-down-handling
      I haven't get a chance to test the above code but its my suggestion. You can tweak the code according to your requirement.

  • Steven Rodrigues
    Steven Rodrigues 2 years ago +1

    Firstly thanks for this video tutorial. just have 3 question regarding the the video
    1. Is there a way to ensure the window which contains the website Url opens in a full screen(maximize window) rather than a normal window.
    2. It gets really annoying to keep hitting the play to execute the code automatically. Can we create a command button on the excel sheet to execute the run button from the sheet itself?
    3. apart from the get element by id what are the other methods to get the info from a website.. like texts or hyperlinks ?
    Once again thanks for this kickass video ;) !!!
    Cheers.

    • Amarindaz
      Amarindaz  2 years ago

      Soon I'll create videos for the same