我正在尝试获取下面链接的网页的屏幕截图,然后将其粘贴到word中。我有一些代码应该执行此操作,但是每次运行它都会出现一个hwnd = 0
错误窗口。有人可以指出我要去哪里了。
Sleep 5000
'~~> Get the caption of IE
IECaption = "Protex Soap Deep Clean (1 x 150g)- Lowest Prices & Specials Online | Makro - Internet Explorer"
'~~> Get handle of IE
hwnd = FindWindow(vbNullString, IECaption)
If hwnd = 0 Then
MsgBox "IE Window Not found!"
Exit Sub
答案 0 :(得分:0)
ShellWindows
是Internet Explorer和File Explorer窗口。
Set objShell = CreateObject("Shell.Application")
Set AllWindows = objShell.Windows
For Each window in AllWindows
msgbox window.locationname & vbcrlf & typename(window.parent) & vbcrlf & window.name
Next
或者上面的window
对象是IE对象。
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate2 "www.google.com.au"
ie.visible=true
wscript.sleep 5000
ie.refresh2