Selected item in drop-down (on Webpage) not reflecting in table data even after FireEvent command

vikas0903

New Member
Joined
Dec 17, 2013
Messages
20
Hi all,

Thanks for taking time to read this through. Will appreciate any help.

I am trying to pick a date on drop-down list on this page, and view results through VBA:
Page URL: 4D - Results

I have been able to change value in drop-down but still tables are not reflecting selected drop-down value.

My code (so far) is:

Code:
    Dim IE As InternetExplorer
    Dim doc As HTMLDocument
    Dim LoginForm As HTMLFormElement
    Dim UserNameInputBox As HTMLInputElement
    Dim cURL As String

    Set IE = New InternetExplorer
    cURL = "http://www.singaporepools.com.sg/en/lo/ldc/Pages/4d_result.aspx"
    
    IE.Visible = True
    IE.navigate cURL
    
    'Wait for initial page to load
    
    Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop

    Set doc = IE.document
    
    
    Set UserNameInputBox = doc.getElementById("drawDropDownList")
    UserNameInputBox.selectedIndex = 11  'working. able t o set drop-down value'
    
    doc.forms("aspnetForm").FireEvent ("onsubmit") 'not working.

Please help.

Regards!
Vikas
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
An odd variable name and it should be a HTMLSelectElement, but try:
Code:
    UserNameInputBox.FireEvent "onChange"
 
Upvote 0
Thanks for suggestion. I found out solution for my problem. here is the description:
1) If I have IE9, then .FireEvent "onChange" doesn't work. It works for IE8 (I know) and maybe for other versions as well.
2) Since I had IE9, it was not working for me. So I got alternate solution at this link:
VBA+IE9 FireEvent ("onchange") doesn't work

For IE9, one needs to use dispatchevent as described in that links.

Thanks again for your time.
Regards!
Vikas
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top