2

I am new to vbscript and running procedures. I found some code that I'm trying to test so that I can get a feel for how vbscript works, and I am not sure why I am receiving an error message. I have created the below code in NotePad and then saved the file as a .vbs file on my desktop. Here is the code:

i=10

If i=10 Then

msgbox("This is my first script, Click OK to close")

Else

msgbox(“Hello world”)

End if

I thought that I would be able to open the file and get the message. Instead I am receiving the following error message:

Windows Script Host

Script: (my file location on my desktop) Line: 9 Char: 8 Error:

Invalid character Code: 800A0408 Source: Microsoft VBScript compilation error

2 Answers 2

2

Replace

msgbox(“Hello world”)

with

msgbox("Hello world")

Sign up to request clarification or add additional context in comments.

2 Comments

Beautiful, thank you so much for the quick response!
No worries ... always make sure that the vbscript code is in ANSI format.
1

It looks like line 9 character 8 is a “ and not a " character. That is probably the issue. You would also need to replace the ” character after world with a " character.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.