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”:
无效的过程调用参数,有帮助吗?
最佳答案
试试这个:
...
AppActivate ("Microsoft excel")
xreply = MsgBox("Is this page for women? Record:" & i, vbYesNo, "Checker")
...
关于vba - 如何将焦点带到msgbox?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18832966/