Anyone know how to get around the max string size in VBA editor?
I need to build a string that is over 5000 chars inside the editor. Anyone know a way to achieve this?
Anyone know how to get around the max string size in VBA editor?
I need to build a string that is over 5000 chars inside the editor. Anyone know a way to achieve this?
Last edited by JapanDave; 07-09-2017 at 06:12 PM.
Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
I am the real 'Napster'
The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...
If you receive help please give thanks. Click the * in the bottom left hand corner.
snb's VBA Help Files
as you will see if you run this macro, a VBA string can be much greater than you believe
- generated string is "A" repeated 20 million times....
- your limit problem is something else
what are you trying to do with the string?
- post your code enclosed in code tags
Please Login or Register to view this content.
Last edited by kev_; 07-07-2017 at 10:49 AM.
Click *Add Reputation to thank those who helped you. Ask if anything is not clear
You mean within the limitations of 1023-character line length and 14 continuation lines?
Even with that, I could create a 15K character string.
In the alternative, you could create several shorter strings and catenate them, or put up to 32K characters in a cell and retrieve if from there.
Entia non sunt multiplicanda sine necessitate
That is all well and good loading it into a variable. What I am talking about is an actual string in the VBA editor.
ie,
Paste this into your VB editor and see how you go. See if you can get that whole variable to work for you?Please Login or Register to view this content.
Last edited by JapanDave; 07-07-2017 at 11:21 AM.
Please Login or Register to view this content.
Why would you want to type a 5k+ character string directly into your code, if I might ask?
Don
Please remember to mark your thread 'Solved' when appropriate.
OK, so you need to apply line breaks to get it to work. Nice work around.
B/c I am working in C# and it is easier to get what data you want there and then pass it to Excel to manipulate the data. I am building a macro with com objects in C# to make a file that people can us.
Bear in mind there's a max of 24 line continuations allowed in a statement (25 'physical' lines in the editor). To get around that you'll have to split the string
Please Login or Register to view this content.
You're welcome.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks