• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to add value in textbox in webpage using vba

Ajinkya_2019

New Member
  1. Today, 08:58 AM#1
    ★ Ajinkya_1988
    Ajinkya_1988 is online now

    New MemberJoin DateMar 2019Posts2Post Thanks / Like Mentioned0 Post(s)Tagged0 Thread(s)

    Default
    add value in textbox in webpage using vba

    i am new to this forum. please solve my below query.
    i want fill text box with my given value and click on search button. i cant provide the url as it will not work outside the office. i tried but getting object dose'nt support propery error and method.

    For text box inspect element id and name is given.

    For Search button inspect element is : type Submit

    below is my code:


    Code:
    Sub login_page()

    Dim ieApp As SHDocVw.InternetExplorer
    Dim ieDoc As MSHTML.HTMLDocument


    'create a new instance of ie
    Set ieApp = New InternetExplorer

    'you don’t need this, but it’s good for debugging
    ieApp.Visible = True

    'assume we’re not logged in and just go directly to the login page
    ieApp.navigate "http:"
    Do While ieApp.Busy: DoEvents: Loop
    Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop

    Set ieDoc = ieApp.document

    'fill in the login form – View Source from your browser to get the control names
    With ieDoc.forms(0)
    .user.Value = "id"
    .Password.Value = "password"
    .submit
    End With

    ieApp.navigate "http:"
    Do While ieApp.Busy: DoEvents: Loop
    'Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop

    ieApp.navigate "http:"
    Do While ieApp.Busy: DoEvents: Loop

    ieApp.navigate "http:"
    Do While ieApp.Busy: DoEvents: Loop


    'Dim ie As HTMLInputElement
    ieApp.document.parentWindow.execScript "****************='Go?action=agent'"


    ieApp.document.getElementsById("go").Value = "123"


    With ieApp.document
    .getElementById("go").Value = "123"

    End With


    ieApp.document.parentWindow.getElementsbyid("go").Value = "123"


    ieApp.document.parentWindow.getElementbyid("go").Value = "123"

    ieApp.document.getElementById("go").Value = "123"


    End Sub
 
Back
Top