|
と思ったけど、まあ一応、書いておきます。
↑でヒントは書いたけど、誤って伝わっても何なので。
---
Option Explicit
Private Declare Function GetLastActivePopup Lib "user32" _
(ByVal hwndOwnder As Long) As Long
Private Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" (ByVal hwnd As Long, _
ByVal Msg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const WM_COMMAND = &H111
Sub test()
Dim hDlg As Long
Dim objIE As Object
Dim i As Long
Dim obj As Object
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.navigate ""
End With
Do
DoEvents
Loop While objIE.Busy
Do
DoEvents
Loop While objIE.Document.ReadyState <> "complete"
For Each obj In objIE.Document.all
If obj.tagName = "INPUT" Then
If obj.Value = "投 票" Then
Exit For
End If
End If
i = i + 1
Next
objIE.Document.Script.setTimeout "javascript:document.all.item(" & i & ").click()", 1000
'ダイアログのウィンドウハンドルを取得。
Do
DoEvents
hDlg = GetLastActivePopup(objIE.hwnd)
Loop Until hDlg <> objIE.hwnd
'ダイアログのOKボタン押下
PostMessage hDlg, WM_COMMAND, vbOK, 0
End Sub
|
|