Excel Vba IE_automate: how to trigger changes on dropdown list
Please visit the webpage www.twse.com.tw/zh/page/trading/fund/MI_QFIIS.html www.twse.com.tw/zh/page/trading/fund/MI_QFIIS.html
First dropdown list = year
Second dropdown list = month
Third dropdown list = day
If I manually change the value of second dropdown list, the month from 02 to 01, the value of third dropdown list will automatically change to 01. (first day of month)
however, if I use the follow codes. the value of third dropdonw list wont change. I tried t.fireevent("onchange") but not working
Sub Getvaule() Set ie = CreateObject("internetexplorer.application") ie.Visible = True ie.navigate ("http://www.twse.com.tw/zh/page/trading/fund/MI_QFIIS.html") While ie.readystate <> 4 Or ie.busy Wend For Each t In ie.document.getElementsByTagName("select") If Trim(t.Name) = "mm" Then t.Value = "1" While ie.readystate <> 4 Or ie.busy Wend End If Next End Sub Edited. sendkeys_example for reference
Sub sendkeys_example() Dim ie, x Set x = CreateObject("wscript.shell") Set ie = CreateObject("InternetExplorer.Application") ie.Navigate "http://www.twse.com.tw/zh/page/trading/fund/MI_QFIIS.html" ie.Visible = 1 ie.Toolbar = 0 While ie.readystate <> 4 Or ie.Busy Wend x.SendKeys "{tab 4}", True x.SendKeys "{down}" End Sub 
SendKeysto mimic what you are doing manually. In your example 3 Tabs bring you to the years combo, Enter opens the combo etc. This way you will have no problem