Variable Length String

  • Thread starter Thread starter Q
  • Start date Start date
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top