I am running vb script its showing error can anyone help what is the error i cannot find what is the error it shows error
72 Answers
VBScript doesn't have strong types. Everything is Variant. The error message in your edit is fairly clear as to the solution:
Line:4 Char:16 - Expected end of statement.
So looking at the code...
Dim bSendEmail as boolean = true
' ^char 16...it's telling you to end the statement there. It should be:
Dim bSendEmail
bSendEmail = True 3 CreateObject (Windows Script Host) method creates a COM object.
You need to use SET statement to assign an object reference to a variable:
''' …
Dim bSendEmail: bSendEmail = True ''' colon instead new line: it's not a good practice
''' …
If bSendEmail Then ''' ↓↓↓ SET myemail = CreateObject("CDO.Message") ''' … SET myemail = Nothing ''' ↑↑↑
End If 2