none
VBA code to select a dropdown(Ajax) of web page RRS feed

All replies

  • What is the exact URL?  I don't know what AJAX is, but your script will probably look something like this . . .

    Sub passValueToComboBox1()
       Dim ie  As Object
       Dim oHTML_Element As IHTMLElement
    
       Set ie = CreateObject("InternetExplorer.Application")
       ie.Visible = True
       ie.navigate "URL"
       While ie.Busy Or ie.readyState <> 4: DoEvents: Wend
    
       Set oHTML_Element = ie.document.getElementsByName("HTML_Element_Name_Here")(0)
       If Not oHTML_Element Is Nothing Then oHTML_Element.Value = "here.is.your.combobox.value"
    
       For Each oHTML_Element In ie.document.getElementsByTagName("input")
          If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
       Next
    End Sub
    


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Thursday, January 7, 2016 4:39 AM
  • Javascript/Ajax is a technique to dynamically load the dropdown control.  When I write it I generally initialize the dropdown when the page is loaded but I have seen it initialized when the dropdown arrow is clicked.  You need to verify how it works.  I generally use Firebug in Firefox to examine the HTML.
    Thursday, January 7, 2016 1:03 PM