An absolute newbie to Excel VBA. so I copied a script from "VBA for dummies" and pasted it in a new module from a new worksheet in a new workbook. Below is what I pasted.
Sub GuessName()
Msg = Is your name & Application.UserName & ?
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then MsgBox Oh, never mind.
If Ans = vbYes Then MsgBox I must be
psychic!
End Sub
When I hit "Run", it showed "Compile error: Syntax error". A yellow arrow showed up next to "Sub GuessName ()", which is highlighted in yellow. And it seems that the second line "Msg = "..... " is also highlighted, but in blue.
I have NO idea why there is a Syntax error. The book didn't say anything (so I assume there should be NO Syntax error". Any help ??
Bookmarks