Date VBscript-多行IF语句产生错误

Date VBscript-多行IF语句产生错误,date,if-statement,vbscript,Date,If Statement,Vbscript,我有一个基本的脚本,一年来一直没有问题。最近,我尝试在其中添加一个IF语句,因此如果当前日期是一年中的某一天,即1月18日,则不要使用Msgbox。我认为这是相当直接的,但在IF语句的第一行遇到了子或未定义的函数,我似乎无法自己解决: If Not CStr(Date()) Like "1/18/*" _ And Not CStr(Date()) Like "2/15/*" _ And Not CStr(Date()) Like "12/31

我有一个基本的脚本,一年来一直没有问题。最近,我尝试在其中添加一个
IF
语句,因此如果当前日期是一年中的某一天,即1月18日,则不要使用Msgbox。我认为这是相当直接的,但在IF语句的第一行遇到了
子或未定义的函数
,我似乎无法自己解决:

If Not CStr(Date()) Like  "1/18/*" _ 
And Not CStr(Date()) Like "2/15/*" _
And Not CStr(Date()) Like "12/31/*" Then
MsgBox "perform task"
Else
MsgBox "do not perform task"
End If

有人能告诉我缺少什么吗?

VBScript中没有类似的操作符。实现您想要做的事情的一种方法是:

MonthAndDay = Month(Date) & "/" & Day(Date)

If MonthAndDay <> "1/18" _
   and MonthAndDay <> "2/15" _
   and MonthAndDay <> "12/31" Then
   MsgBox "perform task"
Else
   MsgBox "do not perform task"
End If
MonthAndDay=月(日)&“/”日(日)
如果每月“1/18”_
和“2/15”月日_
然后是“12月31日”
MsgBox“执行任务”
其他的
MsgBox“不执行任务”
如果结束
这里可以回答这个问题:。