Set oAutoText = Templates(ActiveDocument.AttachedTemplate).AutoTextEntries _ 'Create an AutoText with the current selection as the content 'You could instead use any range from the document '= 'The macro illustrates how you can create an AutoText 'without first inserting the contents in a document 'You may need to include error handling 'NOTE: YOU CAN ONLY CREATE AUTOTEXT WITH PLAIN TEXT UP TO 255 CHARACTERS USING THIS METHOD '= 'YOU ARE NOT ALLOWED TO PUBLISH THE MACRO AS YOUR OWN, IN WHOLE OR IN PART. YOU ARE WELCOME TO USE THE MACRO BUT YOU MUST KEEP THE LINE ABOVE. '= 'Macro created 2008 by Lene Fredborg, DocTools - 'THIS MACRO IS COPYRIGHT. Sub CreateAutoTextWithoutInsertingContentInDocument()
CREATE AUTOTEXT IN OUTLOOK HOW TO
If you need help on installing macros, see How to install a macro.
The macrosīelow, you will find the macro code. Note that the link below includes both macros described above. This way, the Value property may contain fewer than 255 characters of the AutoText content as it appears for the user since additional data in the Value property may take up some of the 255 characters as illustrated in this example. For example a DocProperty field that refers to a custom document property named "Name" and with the value "John Doe" will appear as follows in the Value property: More about the Value property of AutoText entriesįields and other types of special content are stored in the Value property using a special syntax. Corresponding to the procedure described above, you can change the contents of any existing AutoText – or you can replace a certain string in any AutoText.Įxample: you want to replace the string "abc" in all AutoText entries in a specific template with "12345".Īn example of such macro can be viewed or downloaded via the link below.