0

I am having all kinds of problems with VBScript. It seems to be originating at the If Then statements. This is the code...

Option Explicit
Dim User, Pass

User=InputBox("Username")
If User = Guest then
 msgbox "hi"

It just doesn't work and its giving me the error code 800A03F6 What do I need to do to fix this? The error is on line 6.

2 Answers 2

2

Either this .....

Option Explicit
Dim User
User = InputBox("Username")
If User = "Guest" then
  MsgBox "hi"
End If

Or ...

  Option Explicit
    Dim User
    User = InputBox("Username")
    If User = "Guest" then MsgBox "hi"
Sign up to request clarification or add additional context in comments.

Comments

0

You're trying to use a string as a variable, and it isn't one (at least from the code you posted). Guest is not declared at all. You need to quote the string.

Try this instead:

User = InputBox("Username")
If User = "Guest" then
  MsgBox "hi"

1 Comment

Thank you, that is what I needed to do the whole time. I just needed to quote my strings.

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.