Hi, its me again ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I'm using John Walkenbach's book "Excel 2007 VBA Programming for Dummies" as was recommended. Well the non 2007 version was recommended and I already had the book but since I"m using 2007 and somehow its supposed to be a lot different (except the VBE is the same) there are new commands or something.
I just typed my first code and it should throw up a small dialog box asking me if my name is (my name) and yes or no.
I get a compile error "Variable not defined"
Then the Sub GuessName() line turns yellow and the cursor location is over the first "MSG"
Have I got an error in my typing, or how can I tell what variable is wrong? I checked to see and my name is in the Help > About area showing I'm the user... I'm very confused at this point as to why this is not working.
I'm trying here but unless I understand why this is not working I'm stuck... help me get a handle on this please.
Thanks
Laurie
LadyCK3
aka: Laurie![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I'm using John Walkenbach's book "Excel 2007 VBA Programming for Dummies" as was recommended. Well the non 2007 version was recommended and I already had the book but since I"m using 2007 and somehow its supposed to be a lot different (except the VBE is the same) there are new commands or something.
I just typed my first code and it should throw up a small dialog box asking me if my name is (my name) and yes or no.
I get a compile error "Variable not defined"
Then the Sub GuessName() line turns yellow and the cursor location is over the first "MSG"
Have I got an error in my typing, or how can I tell what variable is wrong? I checked to see and my name is in the Help > About area showing I'm the user... I'm very confused at this point as to why this is not working.
Code:
Option Explicit
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 clairvoyant!"
End Sub
I'm trying here but unless I understand why this is not working I'm stuck... help me get a handle on this please.
Thanks
Laurie
LadyCK3
aka: Laurie