Variable Length String

Q

Q

hi,
i have the following code:

Dim Msg As String
Msg = Msg & "Award Title:" & Cells(r, 9) & vbCrLf

now when i run the marcro, i get the following error:

Run-time error '5':
Invalid procedure call or argument

but when i shorten the title from from 50 characters to
about 15 characters it works fine. is there a limit on
how many characters a string can have, if not why am i
getting this error? any assistance is greatly
appreciated, thanks in advance.

~q
 
D

Dave Peterson

From xl2002's help (I hit F1 with the cursor on "String" in the dim statement):

There are two kinds of strings: variable-length and fixed-length strings.

A variable-length string can contain up to approximately 2 billion (2^31)
characters.

A fixed-length string can contain 1 to approximately 64K (2^16) characters.


So I don't think it's the length that's causing trouble.
 
Top