Excel 2003 VBA string literal help location

November 13th, 2011 - 12:28 am ET by Walter Briscoe | Report spam
I run VBA in Microsoft Visual Basic 6.5.1053 from Microsoft Office Excel
2003 (11.8332.8333) SP3 from Windows Vista Business Service Pack 2.

1) What help topic specifies the rules for forming a VBA string literal?
AFAIK, these are something like: A string literal is a sequence of
characters, starting and ending with a quote, in which a quote is
represented by two quotes.
e.g. "Hello, World" which has the value Hello, World and
"""Hello, World""" which has the value "Hello, World".

I think that a string literal can't specify more than one line.
e.g. This is an error:
"Hello,
World".
Backslash is not an escape character.
e.g. The value of """Hello, World""" is "Hello, World".
If You want that vbCrLf is your friend.
e.g. """Hello, " & vbCrLf & "World""".

When I ask for help on string literal, I get a myriad of hits, none of
which seem relevant to my interest.

2) How is help data organised, physically? If I could grep (a UNIX text
search program) the text, I might get a pointer to the answer to 1)
above, and subsequent awkward help questions. I may be looking in the
wrong place for the answer to 1).

Microsoft has a VBA specification document.
<http://msdn.microsoft.com/en-us/lib...9.aspx>
points to
<http://download.microsoft.com/downl...448b-907d-
13985accf53e/%5BMS-VBAL%5D.pdf>
in which "3.3.4 String Tokens" contains the relevant information. (In
my time, I have read syntax descriptions and believe I understand the
slightly cryptic presentation.) Sadly, I interpret it to mean that
"Hello,
World" is a valid String Token. I can't insert such a token in code. ;)

Please note that my interest is in reading how to create valid string
literal in a help topic, rather than merely knowing how to construct a
string literal.
Walter Briscoe
email Follow the discussionReplies 9 repliesReplies Make a reply

Replies

#1 isabelle
November 13th, 2011 - 12:54 am ET | Report spam
hi Walter,

MsgBox "how to do a Carriage return" & vbCrLf & "ok it's fine"

MsgBox "how to do a double Carriage return" & vbCrLf & vbCrLf & "ok it's fine"


isabelle

Similar topics