2
Private Sub CommandButton1_Click()
Dim i As Long
Dim xreply As Integer
Dim names As Long

Dim IE As Object

i = ActiveSheet.Range("D1").Value

While Not IsEmpty(ActiveSheet.Range("A" & i).Value)

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "WEBSITENAME" & ActiveSheet.Range("A" & i).Value 

'wait for webpage to load
Do
    DoEvents
Loop Until IE.READYSTATE = 4

'pagedown to the info
Application.SendKeys "{PGDN}", True
Application.SendKeys "{PGDN}", True

xreply = MsgBox("Is this page for women? Record:" & i, vbYesNo, "Checker")
Application.Visible = True
AppActivate ("Checker")

If xreply = vbYes Then
    ActiveSheet.Range("B" & i).Value = "Yes"
    Else
    ActiveSheet.Range("B" & i).Value = "No"
End If

'quit IE
IE.Quit
i = i + 1
ActiveSheet.Range("D1").Value = i
Wend

End Sub

以上是我的代码。我试图将 msgbox 放在前面,但我无法让 AppActivate 这样做。

当我离开 AppActivate("Checker") 我得到:运行时错误'5':无效的过程调用参数,帮助?

4

1 回答 1

5

试试这个:

...
AppActivate ("Microsoft excel")
xreply = MsgBox("Is this page for women? Record:" & i, vbYesNo, "Checker")
...
于 2013-09-16T20:01:01.280 回答