I have the following code:
Dim todaysDate
todaysDate = Day(Now)
Select Case todaysDate
Case 1 to 5
Msgbox("1 to 5")
Case 23 to 31
Msgbox("23 to 31")
End Select
When I put it in a VBS file and run it, i get “Expected Statement” for Line 9 Char 10.
If i copy and paste the code into Excel’s VBA editor, it runs fine with no errors.
Any ideas why it isnt working in a VBS file?
In VBScript, the
Casestatement doesn’t allow thex To ysyntax. You’re only allowed to use a single value or a comma-delimited list of values. You’ll have to use an If/ElseIf statement instead.