Re: string limit when using selection.typetext? by Russ
Russ
Sun Nov 04 21:12:11 PST 2007
Lucas,
Another option is use:
=====Quote From VBA Help
InsertFile Method
See Also Example Applies To
Inserts all or part of the specified file.
Syntax
expression.InsertFile(FileName, Range, ConfirmConversions, Link, Attachment)
expression Required. An expression that returns a Range or Selection
object.
FileName Required String. The path and file name of the file to be
inserted. If you don't specify a path, Word assumes the file is in the
current folder.
Range Optional Variant. If the specified file is a Word document, this
parameter refers to a bookmark. If the file is another type (for example, a
Microsoft Excel worksheet), this parameter refers to a named range or a cell
range (for example, R1C1:R3C4).
ConfirmConversions Optional Variant. True to have Word prompt you to
confirm conversion when inserting files in formats other than the Word
Document format.
Link Optional Variant. True to insert the file by using an INCLUDETEXT
field.
Attachment Optional Variant. True to insert the file as an attachment to a
WordMail message (Windows only).
======UnQuote
>
> "Lucas Karpiuk" <nospam@speedofwood.com> wrote in message
> news:BC434BC2-7127-4566-8665-690030DDF4D5@microsoft.com...
>> i've stored a very large string, myBody
>>
>> Len(myBody) returns roughly 230,000
>>
>> for some reason, when i try to
>>
>> selection.typetext(myBody)
>>
>> only about 16,000 characters are being inserted
>>
>> am i just completely missing something, or is this something i should just
>> know and expect to work around (assuming the latter, what's the suggested
>> workaround?)
>
> Various methods of the Word object model do have limitations in the length
> of strings they can take. I didn't know about this specific one, but I'm not
> overly surprised. There are various options available to you.
>
> 1. See if different methods get round the limitation. For instance, try the
> InsertAfter method instead of the TypeText method, or try assigning myBody
> to the Selection.Text property.
>
> 2. Use the Mid function to create chunks of 15k or so, and insert them a
> chunk at a time.
>
--
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID