Created
May 30, 2014 23:17
-
-
Save kumatti1/0162c4c2f5115bdda3ba to your computer and use it in GitHub Desktop.
ドロップダウンリスト開く
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Type GUID | |
Data1 As Long | |
Data2 As Integer | |
Data3 As Integer | |
Data4(0 To 7) As Byte | |
End Type | |
Private Declare PtrSafe _ | |
Function IUnknown_QueryService Lib "shlwapi.dll" ( _ | |
ByVal punk As IUnknown, _ | |
guidService As GUID, _ | |
riid As GUID, _ | |
ppvOut As IAccessible _ | |
) As Long | |
Sub hoge() | |
Dim IID_IAccessible As GUID | |
With IID_IAccessible | |
.Data1 = &H618736E0 | |
.Data2 = &H3C3D | |
.Data3 = &H11CF | |
.Data4(0) = &H81 | |
.Data4(1) = &HC | |
.Data4(2) = &H0 | |
.Data4(3) = &HAA | |
.Data4(4) = &H0 | |
.Data4(5) = &H38 | |
.Data4(6) = &H9B | |
.Data4(7) = &H71 | |
End With | |
Dim ie As Object | |
Set ie = CreateObject("InternetExplorer.Application") | |
ie.Visible = True | |
ie.Navigate "http://www.7key.jp/hp/_form/6.html" | |
While ie.busy Or ie.ReadyState <> 4 | |
DoEvents | |
Wend | |
'ComboBoxの参照をセット | |
Dim cmb As MSHTML.IHTMLSelectElement | |
Set cmb = ie.document.all("kamoku2") | |
'目的のComboBoxかどうかの確認 | |
'cmb.selectedIndex = 1 | |
Dim hr As Long | |
Dim pElement As MSHTML.IHTMLElement | |
Set pElement = cmb | |
'IHTMLElementからIAccessibleを取り出す | |
Dim acc As IAccessible | |
hr = IUnknown_QueryService(pElement, IID_IAccessible, IID_IAccessible, acc) | |
'Debug.Print acc Is Nothing, Hex(hr) | |
If hr < 0 Then Exit Sub | |
'Debug.Print acc.accChildCount | |
'ドロップダウンリスト開く | |
acc.accDoDefaultAction 2& | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment