Consulting

Results 1 to 7 of 7

Thread: Filling out IE form with data from Excel - and some other stuff :)

  1. #1
    VBAX Newbie
    Joined
    Mar 2011
    Posts
    2
    Location

    Red face Filling out IE form with data from Excel - and some other stuff :)

    Hey all, this is my first post - and i have been reading some of the stuff people are doing and I never knew Excel had such functionality. I hope you can help or point me in the right direction with this question - I'm not as familiar with VBA but have coding experience. Here's what I want to do:
    There is a web form that my company uses a lot to find out if certain users are eligible. It consists of a web form with 4 textboxes to fill out. In my excel spreadsheet I have 4 columns of data - each row containing the information for the 4 textboxes in the webform. I want the VBA to do the following when the macro is run:
    1) switch focus to Internet Explorer (which will have the page with the webform already loaded and the cursor in the first text box)
    2) enter in the first textbox the value in A1
    3) tab
    4) enter in the 2nd textbox the value in A2
    5) tab
    6) enter in the 3rd textbox the value of A3
    7) tab
    8) enter in the 4th textbox the value of A4
    9) press submit on the webform
    10) wait 5 seconds (for the results to load on the webform)
    11) print (file, print) the results in IE
    12) hit the back button (to go back to webform)
    13) enter the first textbox the value in B1

    and on and on until there are no longer values in the rows in the excel spreadsheet.

    Is this even possible to do using VBA? and if so, please head me in the right direction as this will certainly solve a lot of problems for me and my departments. I really appreciate your advice and knowledge. thanks a million

    J.

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    what's the url ?

  3. #3
    VBAX Newbie
    Joined
    Mar 2011
    Posts
    2
    Location
    you have to log into the site before you get to the form page so you wouldn't be able to see it yourself. What information do you need about the form. Perhaps I could identify that and we could move forward.,

    thanks again
    J.

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Since we can't test it, it is hard to help. The best way to get help in that case is to provide screen prints for each part and the Page Source. Some sites are secure where only SendKeys() solutions would work. We can only see that in the Page Source. In Firefox, click the View button to get a website's Page Source text.

  5. #5
    VBAX Newbie
    Joined
    Jul 2012
    Posts
    2
    Location

    fill out web form macro

    Hey, I also have same problem here. I don't know anything about vba but somehow I managed to come up with a macro (by reading forums) to fill out a web form from excel.
    Here's the code which successfully open up the browser, go to website, fill out the form and submit. I want to do this for the remaining rows. (Each row = 1 submission) How can I do this? Also is it possible to open the website in a tab instead of another window when the macro runs?

    [VBA]Sub Fill_Form()
    Set IE = CreateObject("InternetExplorer.Application")
    With IE
    .Visible = True
    .navigate URL:="THEURL"
    Do Until .readystate = 4
    DoEvents
    Loop
    Set mytextfield1 = .document.all.Item("pin[title]")
    mytextfield1.Value = Sheets("Sheet1").Range("b3").Value
    Set mytextfield2 = .document.all.Item("pin[merchant]")
    mytextfield2.Value = Sheets("Sheet1").Range("c3").Value
    Set mytextfield3 = .document.all.Item("pin[offer_type]")
    mytextfield3.Value = "coupon"
    Set mytextfield4 = .document.all.Item("pin[code]")
    mytextfield4.Value = Sheets("Sheet1").Range("d3").Value
    Set CreatePin = .document.all.Item("commit")
    CreatePin.Click

    End With
    End Sub[/VBA]


    I know this site is over a year ago.. I hope anyone out there could help me.
    Thank you in advance!

    --
    angel
    Last edited by Bob Phillips; 07-25-2012 at 12:07 AM. Reason: Added VBA tags

  6. #6
    VBAX Newbie
    Joined
    Jul 2012
    Posts
    2
    Location
    Quote Originally Posted by Kenneth Hobs
    Since we can't test it, it is hard to help. The best way to get help in that case is to provide screen prints for each part and the Page Source. Some sites are secure where only SendKeys() solutions would work. We can only see that in the Page Source. In Firefox, click the View button to get a website's Page Source text.
    I'm hoping that you could help me out..
    Thank you!

  7. #7
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Maybe change
    [VBA]Set IE = CreateObject("InternetExplorer.Application")[/VBA]
    to
    [VBA]Set IE = GetObject("InternetExplorer.Application")[/VBA]
    No errorchecking, so better be sure that Internet Explorer is running.

    If you want to loop the rows in a worksheet, you have to build a loop around the filling in of the internet form.

    Charlize

Posting Permissions

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