Use #Const to define the constant
#Const UseEventLog = True
Private Sub DebugPrint(ByVal Source As String, ByVal Message As String)
#If UseEventLog Then
Call EventLog.WriteEntry("Source: " & Source & " Message: " & Message)
#Else
Debug.Print "Source: " & Source & " Message: " & Message
#End If
End Sub
Related examples in the same category