VBA關閉在IE中打開的WORD?
把下面代碼中的“網頁標題”改為你要關閉的IE的標題,然后運行,即可關閉在IE中打開的WORD:
Dim oShellApp, oShellAppWindows, oWin Set oShellApp = CreateObject("Shell.Application"
) Set oShellAppWindows = oShellApp.Windows For Each oWin In oShellAppWindows If LCase(TypeName(oWin.document)) = "htmldocument" Then If InStr(1, oWin.locationname, "網頁標題", vbTextCompare) > 0 Then oWin.Navigate "about:blank" Exit For End If End If Next Set oWin = Nothing Set oShellApp = Nothing Set oShellAppWindows = Nothing
下一篇你最喜歡哪首詩