+ Reply to Thread
Results 1 to 8 of 8

Internet Explorer interaction

  1. #1
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379

    Internet Explorer interaction

    Good afternoon all,

    I have a webform for my company that we fill in with repetative data from excel, I am trying to populate it automatically but I am rubbish with websites so I have no idea how to get VB to control the form. I have managed to get it to populate the form but I cannot get it to submit the data.

    From the page source information I believe I just need it to click the button identified by the following code:

    <p><input type="submit" name="submit" class="button" value="Log in" /></p>

    Can anyone help?

  2. #2
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Internet Explorer interaction

    do you have example sheet?

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Internet Explorer interaction

    Try:
    Please Login or Register  to view this content.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379

    Re: Internet Explorer interaction

    I can't really give away the website address online as it's probably not very secure, but the code I have is in the early stages and is as follows:

    Dim ie As InternetExplorer
    Dim C
    Dim Value1 As Boolean, ieForm
    Dim Value2 As String, MyLogin As String

    redo:
    Value1= Application.InputBox("Please enter value 1", "Ecaytrade username", Default:="Value1", Type:=2)
    Value2 = Application.InputBox("Please enter value 2", "Ecaytrade Password", Default:="Value2", Type:=2)

    If Value1 = "" Or Value2= "" Then GoTo redo

    Set ie = New InternetExplorer
    ie.Visible = True
    ie.Navigate "http://website address"

    'Loop until ie page is fully loaded
    Do Until ie.ReadyState = READYSTATE_COMPLETE
    Loop

    For Each ieForm In ie.Document.forms
    If InStr(ieForm.innertext, "Data Entry") <> 0 Then
    ULogin = True
    'enter details
    ieForm(1).Value = Value1
    ieForm(2).Value = Value2
    ieForm.submit
    Exit For
    Else
    End If
    Next
    Set ie = Nothing
    End Sub

  5. #5
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379

    Re: Internet Explorer interaction

    ieForm.submit is where it fails with runtime error 438.

  6. #6
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Internet Explorer interaction

    Try This

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379

    Re: Internet Explorer interaction

    Sniper - this really did the job! Perfect, thanks!

    Please Login or Register  to view this content.
    One question... if I fill in the form manually I only have to TAB once after entering the second value, why did you include 2 TABs? (You are obviously correct as I tried with only one and it didn't work, just wondering why?)

  8. #8
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Internet Explorer interaction

    it enters the data and then only when you TAB it runs through the fields, we didn't send the tab and entered a value nother tab value and the to submit or log in.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1