Avatar of JohnRobinAllen
JohnRobinAllen
Flag for Canada asked on

Maximum length of document variable using VBA in Word

Working with VBA in Word, I have a long string, 1,899,391 characters long. I want to save it as a document variable. VBA objects and says my string is too long. I’ve tried VBA Help, the Internet, and EE, and nowhere can I find the maximum length possible for a document variable. If I knew that, I could chop my variable into shorter strings to save separately.
    Thanks for any suggestions. I can give further details on the problem if necessary.
     JRA in Priddis, Alberta
Microsoft Word

Avatar of undefined
Last Comment
JohnRobinAllen

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
GrahamSkan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JohnRobinAllen

ASKER
That took about five minutes between time of submission of the question and the answer. Thanks for that help.
     In the meantime I found I made a stupid mistake that created the long string, so for the moment I no longer need that figure. However, in time as this program develops, my string to save will definitely get longer, so that I need that figure for when that happens.
     I'll check the length of the string each time I need to save it, and if the string exceeds 65,280, I'll chop it into two shorter strings, each half the length of the string to save.
     Thanks again to the oracle from London (UK, of course, not London, Ontario).
     John Robin (Allen)
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck