Template is set to Automatically Update Document Styles - Word 200

  • Thread starter Thread starter EKH
  • Start date Start date
E

EKH

I have 850 templates that are set to Automatically Update Document Styles.
Of course, this is a problem as we want to be able to modify styles on the
documents based on these templates without having to change this setting each
time. My goal is to fix the templates.

I know I can change the setting with the following code:

With ActiveDocument
.UpdateStylesOnOpen = False
End With

My real challenge is how to run this on 850 templates. Any ideas?
 
Assuming that all of the templates are in the same folder, something like
this could be used (the code is from the article at
http://word.mvps.org/faqs/macrosvba/BatchFR.htm):

Public Sub BatchModifyDocSettings()

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

PathToUse = "H:\Test\" 'specify the path here

'Error handler to handle error generated whenever
'the FindReplace dialog is closed

On Error Resume Next

'Close all open documents before beginning

Documents.Close SaveChanges:=wdPromptToSaveChanges


'Set the directory and type of file to batch process
'(Note that Word 2007 also supports *.dotx and *.dotm
'templates.)

myFile = Dir$(PathToUse & "*.dot")

While myFile <> ""

'Open document
Set myDoc = Documents.Open(PathToUse & myFile)

myDoc.UpdateStylesOnOpen = False
myDoc.Saved = False
'Close the modified document after saving changes

myDoc.Close SaveChanges:=wdSaveChanges

'Next file in folder

myFile = Dir$()

Wend

End Sub

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
I'm glad it worked for you. Note, however, that Ibby, the author of the
linked article, deserves (most of) the credit.

--
Stefan Blom
Microsoft Word MVP


in message
 

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

Back
Top