When I try the following, it doesn't work, telling me of some case mismatch?
I declare something like Dim someInteger As Integer
I set someInteger = 1
I try to do:
* MsgBox ("Variable someInteger's value is = " + someInteger)
This doesn't work. What do I need to do to make this work?
--
Regards,
Jay Freedman
Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word
"mnewhart" <mnew...@eudoramail.com> wrote in message
news:#dlQKzNLBHA.1312@tkmsftngp07...
Is there a reason for the (+) sign if when you want to show multiple things
of different types, you have to use the (&) sign?
Thanks again for helping!
Jay Freedman <jay.fr...@verizon.net> wrote in message
news:uguVEBOLBHA.1496@tkmsftngp05...
One of the rules of computer programming languages is that a binary operator
(technical term for +, -, &, and other symbols that combine two things) must
have the same data type on both sides. That's often inconvenient for the
human programmer. In some circumstances, where it makes sense, the language
is allowed to do "implicit" conversions (that is, they're allowed to happen
without an explicit function call) on one of the two objects to make it the
same data type as the other.
In the case of
"The value is " & myInteger
VBA is allowed to convert the integer to its string representation. It knows
the result has to be a string because the ampersand is a string operator.
When you tried to use a plus sign in the same kind of expression, VBA said
"you're telling me to convert the string on the left into a number, but
that's not an allowed conversion".
The use of the plus sign to concatenate two strings is a special case that
probably shouldn't be allowed. I think somebody at Microsoft just got tired
of people complaining, and put in the rule "if both sides are strings,
pretend it's an ampersand". :-)
--
Regards,
Jay Freedman
Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word
"mnewhart" <mnew...@eudoramail.com> wrote in message
news:uWMamkOLBHA.1916@tkmsftngp07...
Melissa
Jay Freedman <jay.fr...@verizon.net> wrote in message
news:#FHlVSQLBHA.1372@tkmsftngp07...