在子VBA中停用msgbox [英] Deactivate msgbox in a sub VBA

查看:85
本文介绍了在子VBA中停用msgbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sub prelim()
    MsgboX "Hello World"
End Sub


Sub Main()
    Call prelim
End Sub

在上面的代码中 Sub prelim 无法编辑.当我运行 Sub prelim 时,我想要msgbox,但是当我运行 Sub Main 时,我想要msgbox.我不希望弹出消息框.怎么做?

In the above code Sub prelim can't be edited.I want msgbox when I run Sub prelim but when I run Sub Main I don't want the message box to get popped out. How to do it?

推荐答案

在不更改 Sub prelim

Sub prelim(Optional silent As Boolean = True)
    If Not silent Then MsgBox "Hello World"
End Sub


Sub Main()
    prelim True   'no msgbox
    prelim False  'with msgbox
    prelim        'no msgbx
End Sub

这篇关于在子VBA中停用msgbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆