Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

limit to (Text) arg in TypeText() method?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Charnes - 26 Feb 2007 15:38 GMT
I notice that when I record a new macro from Word (Tools | Macro |
Record New Macro) and the macro includes a lot of straight text typing,
the resultant code consists of many separate TypeText() statements, each
with its (Text) argument consisting of 60 or so characters.  Why does
Word do it like that?  That [Text] arg can be longer than 60 chars, yes?  
What is the limit?  Thanks much.
Helmut Weber - 26 Feb 2007 16:13 GMT
Hi Rick,

>I notice that when I record a new macro from Word (Tools | Macro |
>Record New Macro) and the macro includes a lot of straight text typing,
>the resultant code consists of many separate TypeText() statements, each
>with its (Text) argument consisting of 60 or so characters.  Why does
>Word do it like that?  That [Text] arg can be longer than 60 chars, yes?  
>What is the limit?  Thanks much.

>Why does Word do it like that?

who knows,
maybe 60 characters was a nice value to split lines.

>That [Text] arg can be longer than 60 chars, yes?

indeed. Try:

Selection.TypeText Text:= ActiveDocument.Range.Text

until system crashes.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Rick Charnes - 26 Feb 2007 17:00 GMT
Does anyone know what the limit is?  I guess I could just try it myself,
increasing it until my system crashes!

> Hi Rick,
>
[quoted text clipped - 17 lines]
>
> until system crashes.
Klaus Linke - 27 Feb 2007 02:05 GMT
About 64kB characters (65536), I think. If you need to insert longer text,
.InsertAfter is better.

Regards,
Klaus

> Does anyone know what the limit is?  I guess I could just try it myself,
> increasing it until my system crashes!
[quoted text clipped - 20 lines]
>>
>> until system crashes.
Jezebel - 27 Feb 2007 05:15 GMT
65534 is the max.

Try --

selection.TypeText string(65535, "X")

> About 64kB characters (65536), I think. If you need to insert longer text,
> .InsertAfter is better.
[quoted text clipped - 28 lines]
>>>
>>> until system crashes.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.