Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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? |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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 "EKH" wrote in message ... 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? |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"automatically update document styles" in word 2007 | Microsoft Word Help | |||
How can I update Styles automatically? | Microsoft Word Help | |||
Save 'Automatically update document styles' option to template | Microsoft Word Help | |||
REF fields don't update automatically in template | Microsoft Word Help | |||
How do you REALLY turn off automatically update styles in Word 200 | Microsoft Word Help |