Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autotext Entry in Word

Status
Not open for further replies.

AcousticalConsultant

Technical User
Sep 20, 2001
45
CA
Hi!

I have a bunch of bits of text stored as Autotexts in Word, and when I come to insert them into my document using VBA, a maximum of 255 characters are returned (it's not really a bug, I saw it documented in the on-line help). Does anyone know how this limitation can be overcome (other than creating two autotext entries and inserting them one after the other !!)

My second question relating to the same topic, is that when I insert the autotext into the document (again, using VBA) the text formatting (superscripts, bold, etc.) is gone!!

What bugs me is that when I insert them manually, everything works! (formatting is there, and the string can exceed 255 chars) But as soon as I use a macro to insert them, it's all screwy!

The command line I'm using is the following:

ActiveDocument.AttachedTemplate.AutoTextEntries("MyEntry") _
Where:=Selection.Range

One last thing... when the Autotext contains apostrophes, when I insert them (only when using VBA of course), the apostrophes become equal signs. However, this could be due to the keyboard configuration (I have french and english keyboards installed) so don't spend too much time trying to figure that one out. I created a function which replaces the equal signs back to apostrophes anyway!

Thanks for all the help!

Pascal
 
Use the optional RichText parameter to preserve formatting.
Example straight from the on-line help:

Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.AttachedTemplate.AutoTextEntries("one").Insert _
Where:=Selection.Range, RichText:=True

Ciao,

ilses
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top