Edit autotext entries

F

Fredrik

Hello,

I have a template with several autotext entries. The entries are
different addresses that can be entered in the footer area with a
macro button. I'm looking for a way to edit parts of the autotext
entries without having to insert them, edit them in the document and
re-save them with the same name.
 
T

Tony Jollans

Sorry, there is no way to do this. Autotext entries, themselves, cannot be
edited in Word.
 
F

Fredrik

Sorry, there is no way to do this. Autotext entries, themselves, cannot be
edited in Word.

This seems strange. It is possible to add autotext entries through
VBA, it seem to me there should be a way to edit them too.
 
T

Tony Jollans

You can do through VBA the same as you can do through the UI - that is, add
AutoText entries but not change them.
 
F

fumei via OfficeKB.com

You pull in the contents of an AutoText, delete that AutoText, edit what you
pulled in, and create the AutoText with the same name. This seems bad form
to me.

In any case, that is the best you can do. There is no editing of an AutoText
entry itself.
 
L

Lene Fredborg

You _can_ actually change the contents of an AutoText without inserting the
AutoText. You do this by setting the Value property.

Example: you want to replace the string “abc†in all AutoText entries in a
specific template (here MyTemplate) with “12345â€. To do this:

Dim oAutoText As AutoTextEntry

For Each oAutoText In MyTemplate.AutoTextEntries
oAutoText.Value = Replace(oAutoText.Value, "abc", "12345")
Next oAutoText

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


fumei via OfficeKB.com said:
You pull in the contents of an AutoText, delete that AutoText, edit what you
pulled in, and create the AutoText with the same name. This seems bad form
to me.

In any case, that is the best you can do. There is no editing of an AutoText
entry itself.
 
F

Fredrik

You _can_ actually change the contents of an AutoText without inserting the
AutoText. You do this by setting the Value property.

Example: you want to replace the string "abc" in all AutoText entries in a
specific template (here MyTemplate) with "12345". To do this:

Dim oAutoText As AutoTextEntry

For Each oAutoText In MyTemplate.AutoTextEntries
oAutoText.Value = Replace(oAutoText.Value, "abc", "12345")
Next oAutoText

Ah, fantastic. I found no information about this in the help file.
Thank you very much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top