我正在尝试将当前月份作为 Visual Basic 脚本中的短字符串:
Dim month
Dim mth
month = Now.Month ' This doesn't work.
month = Now().Month ' Tried this too.
month = Month(Now) ' Also tried this.
mth = MonthName(month, True) ' (e.g. "Apr" or "Mar")
但是,我不断收到运行时错误:
Microsoft VBScript runtime error: Object required: 'Now'
Microsoft VBScript runtime error: Object required: 'Now()'
Microsoft VBScript runtime error: Type mismatch 'Month'
我可以Now
很好地用作字符串:
CStr(Now)
或者作为一个普通的值
Dim val
val = Now
如何Now
用作对象来访问其成员函数?也许我将 Visual Basic 功能与 VB 脚本混淆了?