如果声明,或

时间:2015-11-16 13:18:25

标签: if-statement vbscript

我正在尝试检查某个字段是否不是两个值之一,然后显示一条消息。

任何人都可以看到我出错的地方

If  LegalEntity <> "ETL" or "RGB" Then
           Shell.RedoMessage = "Holiday Carry Over and Trading is not enabled for     your Legal Entity. Please click the Cancel button above"
        Exit Sub
End If

1 个答案:

答案 0 :(得分:1)

如果我了解您需要检查 LegalEntity 的值是否“ETL”还是“RGB”

然后它应该是这样的:

'if its not equal to ETL and not equal to RG the enter the condition
If LegalEntity <> "ETL" And LegalEntity <> "RGB" Then
    Shell.RedoMessage = "Holiday Carry Over and Trading is not enabled for your Legal Entity. Please click the Cancel button above"
    Exit Sub
End If