1,488
社区成员
发帖
与我相关
我的任务
分享Dim objShell, objWindows, objIE, strURL, strURL2
strURL = "http://www.qq163.com"
strURL2 = "http://www.qq.com"
strURL = LCase(strURL)
Set objShell = CreateObject("Shell.Application") 'New ShellWindows
Set objWindows = objShell.Windows
For Each objIE In objWindows '枚举所有已打开的ie和explore窗口
If LCase(Right(objIE.FullName, 13)) = "\iexplore.exe" Then '如果是ie窗口
If (LCase(objIE.LocationURL) = strURL) Or _
(LCase(Left(objIE.LocationURL, Len(strURL) + 1)) = strURL + "/") Then '根据网址进行判断
objIE.Navigate strURL2
End If
End If
Next
Set objIE = Nothing
Set objWindows = Nothing
Set objShell = Nothing
MsgBox "ok"