Article ID: 106500
Article Last Modified on 10/11/2006
Text="is a"
MsgBox("This "&Text&" Test")
and you leave out a space between the variable name "Text" and the
ampersand (&), you will receive the error message:
This error occurs because when an ampersand appears after a variable name,
it is interpreted as a type-declaration character. In this example, the
ampersand after the variable name "Text" indicates that Text is being
declared as a Long data type. When the ampersand is interpreted this way,
the rest of the line of code does not make sense. When you insert a space
between the text variable and the ampersand, the ampersand character is
recognized as the text concatenation operator and the error is eliminated.
Text="is a"
MsgBox("This " + Text + " Test")
In the above example, spaces are added automatically.
type-declaration characters
Additional query words: XL
Keywords: kbprogramming KB106500