Does anyone know how to modify the document autoformat feature in MS Word?

149 Views Asked by At

I'm trying to automate applying a format to a document in Word. The Autoformat dialog has three options for Document Type: General Document; Letter; Email. I had thought that I could create a template based on the document type, but I can't find much documentation on this feature and a search of the Word folders doesn't turn up anything promising. Can anyone shed any light on this?

Thanks

Word Autoformat dialog

1

There are 1 best solutions below

2
On

Since this is StackOverflow (=programming) I'm going to assume you're looking for a way to access this via VBA (a macro). The AutoFormat "type" is set using the Document.Kind object, which takes a member of the WdDocumentKind Enum:

wdDocumentEmail        2 E-mail format. 
wdDocumentLetter       1 Letter format. 
wdDocumentNotSpecified 0 No format specified. 

Recording a macro while applying AutoFormat gives code like this:

Selection.Document.Kind = wdDocumentLetter
Selection.Range.AutoFormat

It's not very clear to me why you'd want to use AutoFormat when setting up a template. Usually, when people take the trouble to use a template they also define a set of styles and a UI for people to use the styles...