View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2138_] Rick Rothstein \(MVP - VB\)[_2138_] is offline
external usenet poster
 
Posts: 1
Default Variable Declaration

Now that is funny! You had **exactly** the same reaction to the OP's post
that I did... **exactly**.

Rick


"Bob Phillips" wrote in message
...
Personally, I would throw that book starigt in the bin if I were you.


Dim NewVar%

Nothing specifically wrong with this, but type declaration characters are
a bit old-hat, and it is far better to be specific as with As Long

NewVar = "45"

It is an integer variable so he puts the value in quotes - what a load of
....

MsgBox (NewVar)

By enclosing the variable in parentheses it gets evaluated before being
passed to MsgBox. As it is a simple variable it is unnecessary, and this
sort of notation is not needed and should not be used until if and when
that particular syntax is explained.


--
__________________________________
HTH

Bob

"R Tanner" wrote in message
...
Hi,

I'm reading a book learning how to program and I'm walking through an
example talking about variable declaration. I understand what the
following procedure is doing, but I don't understand what the purpose
of it is. Can anyone help me to understand why I would do this?

Sub Create_Var()

Dim NewVar%
NewVar = "45"
MsgBox (NewVar)

End Sub

Thanks,