在VBA窗口的UserForm_QueryClose事件中添加代码,就会在窗口关闭时执行。
软件版本:Office2013
方法如下:
1.在userfomr1窗口的UserForm_QueryClose事件中添加弹出代码:
2.这样VBA窗体并关闭时,就会自动出现弹窗:
show后加个0
Private Sub UserForm_QueryClose(Cancel As Integer,CloseMode As Integer)
form2.Show 0
End Sub
然后在form2窗体写入代码
Private Sub UserForm_Activate()
Unload UserForm1
End Sub