Runtime Error 5854. String Parameter is too long

M

Meera

Hello,

How do I set a document Variable where the variable name
is greater than 256 characters. I am doing something like
this.

Public Sub SetVariable(varName As String, varValue As
Variant)
Call deleteVariable(varName)
Call ActiveDocument.Variables.Add(varName, varValue)
End Sub

where everytime the varName is greater than 255 characters
it gives me runtime error. Is there a work around for
this where my string length can be breater than this limit.

Thanks in advance.

Meera
 
C

Cindy M -WordMVP-

Hi Meera,
How do I set a document Variable where the variable name
is greater than 256 characters.
You can't. There are certain limits for things, and 256
characters for a docVariable name is one of them.

Why are you trying to create such long names? Could you
truncate them?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
G

Guest

Hi Cindy,

Thanks for the reply, I am doing something similar to
Excle where my VarCodeName is the formula. When I have
more than 4 fromula's the string length is greater than
256 characters. I can not turncate the strig. I think i
will set a message handler for this. Thanks once again
for your time on this.
 

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

Top