+ Reply to Thread
Results 1 to 2 of 2

VBA code to select dropdown value from a website form and submit

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Post VBA code to select dropdown value from a website form and submit

    Hi there,

    I'm having a bit of a problem submitting validation information into a website through an excel field. The first input on the website is a text box which works fine but the second one is a choice of country on a dropdown list. I only have US and Canada as options on my excel sheet and when I run the code using either one of the value selected on Excel field, website opens and enters the first field (text box), but it submits without choosing the right country. Really appreciate your help in fixing this. Following is the vba code:

    Private Sub CommandButton2_Click()

    Set objIE = CreateObject("InternetExplorer.Application")

    dlookup1 = ActiveSheet.Range("$B$6").Value
    dlookup2 = ActiveSheet.Range("$B$7").Value

    With objIE
    .Visible = True
    .navigate "http://mycredit.dnb.com/advanced-company-search/"

    Do While .Busy Or _
    .readyState <> 4
    DoEvents
    Loop
    'This is for the first field (textbox)
    Set what = .document.getElementsByName("dunsNumber")
    what.Item(0).Value = dlookup1

    'This is for the dropdown form
    Set what = .document.getElementsByName("dunsCountry")
    what.Item(0).Value = dlookup2

    objIE.document.forms(0).submit


    Do While .Busy Or _
    .readyState <> 4
    DoEvents
    Loop
    For Each ele In .document.all

    Next ele
    End With
    Set objIE = Nothing

    End Sub

  2. #2
    Registered User
    Join Date
    01-21-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA code to select dropdown value from a website form and submit

    Please anybody I've scoured the internet with no success

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Select dropdown menu on website via vba
    By apatel100 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2013, 12:30 PM
  2. Manipulating Dropdown List in IE using VBA & Form Submit oddities
    By JScottArnold in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-30-2013, 05:43 PM
  3. Help: Submit form to website (PHP System) and retrieve response in Excel
    By AMRayner in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2012, 10:53 AM
  4. Replies: 1
    Last Post: 02-05-2012, 09:31 PM
  5. Trying to submit a filename to a website form for upload.
    By mctabish in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2010, 11:59 PM

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