Excel Automation

How to automate data entry on a Web page using excel macros?

Pre-requisites:

1 . On the Macro Window, Insert a new module
2. Go to Tools/References
3. Select Microsoft Internet Controls
4. Select Microsoft HTML Object Library

Sample code given below:

Sub dataEntry()

    Dim IE As Object
    Dim doc As HTMLDocument
 
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True
 
    IE.Navigate "https://www.automationandagile.com/p/demo-page.html"

    Do While IE.Busy Or IE.ReadyState <> 4
        Application.Wait DateAdd("s", 1, Now)
    Loop
 
    Set doc = IE.Document
 
    doc.getElementById("num1").Value = 5
    doc.getElementById("num2").Value = 4
    doc.getElementById("btnCalculate").Click
         
 
End Sub