Dim IE As SHDocVw.InternetExplorer |
Dim sh As Shell32.Shell |
Set IE = New SHDocVw.InternetExplorer |
IE.Navigate2 strURL |
If IE.LocationURL <> strURL Then |
IE.Quit |
Set sh = New Shell32.Shell |
For Each IE In sh.Windows |
Do Until IE.readyState = READYSTATE_COMPLETE |
DoEvents |
Loop |
' Check if this is the desired URL |
If IE.LocationURL = strURL Then Exit For |
Next IE |
End If |
Set JMNavigate = IE |
End Function ===
Public Function JMNavigate(strURL As String) As SHDocVw.InternetExplorer Dim IE As SHDocVw.InternetExplorer Dim sh As Shell32.Shell Dim eachIE As SHDocVw.InternetExplorer Set IE = New SHDocVw.InternetExplorer IE.Navigate2 strURL 'If IE.LocationURL <> strURL Then ' IE.Quit Do Set sh = New Shell32.Shell For Each eachIE In sh.Windows ' Check if this is the desired URL If eachIE.LocationURL = strURL Then Exit Do Next eachIE Loop 'End If Do Until eachIE.ReadyState = READYSTATE_COMPLETE DoEvents Loop Set JMNavigate = eachIE End Function
|
vba ie 网页
最新推荐文章于 2024-06-20 19:14:44 发布