VBA关闭在IE中打开的WORD

VBA关闭在IE中打开的WORD,第1张

把下面代蚂档亏扒码中的“网页标题”改为你要关闭的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

------游卖虚---------------

Public x As String '申明一个神燃公共变量

Sub A()

End Sub

---------------------------------

Private Sub CommandButton1_Click()'  窗体1控件程序代码

'

'你的过程

'

Dim m%

UserForm2.Show

'

'

If x = "CommandButton2" Then

MsgBox x

Exit Sub

End If

If x = "CommandButton1" Then

MsgBox x

End If

'你的过程'

'

End Sub

----------------

Private Sub CommandButton1_Click()‘’窗体1控件代码

Unload Me

End Sub

Private Sub CommandButton2_Click()

Unload Me

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

x = Me.ActiveControl.Name

End Sub

------------------配颤

Sub SADSAD()

DATER = MsgBox("是否关明闹厅闭网页", vbYesNo, "提示")

If DATER = vbYes Then

Shell ("taskkill /f /im IEXPLORE.exe")

End If

End Sub

此段代码是停止IE的浏览器

如果是360浏览器弯李 或者其激隐他的需要修改


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12446799.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-23
下一篇2023-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存