Sub prelim()
MsgboX "Hello World"
End Sub
Sub Main()
Call prelim
End Sub
在上面的代码中Sub prelim
无法编辑。我在运行Sub prelim
时需要msgbox,但是当我运行Sub Main
时,我不希望弹出消息框。怎么做?
答案 0 :(得分:6)
如果不更改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