取得window对象后再在其基础上操作。
Function FindWindow(sTitle)
Dim wndw
Set FindWindow = Nothing
With Createobject("shell.application")
For each wndw in .windows
If instr(lcase(typename(wndw.document)), "htmldocument") > 0 Then
'reporter.ReportEvent micDone, "debug", wndw.document.title
If Len(sTitle) = 0 and Len(wndw.document.title) = 0 Then
Set FindWindow = wndw
Exit Function
End If
If Instr(lcase(wndw.document.title), lcase(sTitle)) > 0 and Len(sTitle) <> 0 then
Set FindWindow = wndw
Exit Function
End If
End If
Next
End with
End function