📜  excel vba debug.assert - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:57.713000             🧑  作者: Mango

代码示例1
' Test will pause execution on false assert only on debug mode
#Const DebugMode = True
Sub TestMe()
    Dim iVar As Integer
    iVar = -1
    #If DebugMode Then
        Debug.Assert iVar >= 0 ' False -> Pause
        MsgBox "Debug Mode", vbExclamation
    #Else
        MsgBox "Production Mode", vbInformation
    #End If
End Sub