vba 怎么结束运行中的进程

vba 怎么结束运行中的进程,第1张

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

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

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

Shell "taskkill /im 进程名"

如:Shell "taskkill /im notepad.exe"

请参考:

1)http://www.officefans.net/cdb/viewthread.php?tid=112416&page=1#pid811015

2)http://zhidao.baidu.com/question/16519585.html?fr=ala1

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

楼主:终止进程不同于终止程序,这句话一定程度上有道理,如果桥神是一个多进程的程序,当然是对银山的;但如果是单进程,终止进程肯锋消中定就终止了程序。

on error GOTO A

A:msgbox()

在调用的帆帆穗前面on error GOTO A

在SUB结束前面

A:msgbox()‘提示

end'结束轿烂程序

end sub

==============态卜===

你直接吧A放到你程序的结束地方不就好了


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

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

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

发表评论

登录后才能评论

评论列表(0条)

    保存