View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
EKH EKH is offline
external usenet poster
 
Posts: 15
Default Template is set to Automatically Update Document Styles - Word

Fantastic!!! Worked like a charm. Thanks so much!

"Stefan Blom" wrote:

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


"EKH" wrote in message
...
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?