![]() |
|
|
|
#1
|
|||
|
|||
|
Word 2016. I'm looking for a macro that will apply Normal dot styles. I have lots of old Word documents that need updating to, and using the Organizer to import the styles every time is a time consuming process
. |
|
#2
|
|||
|
|||
|
There is a check box on the file.option.add-ins.templates dialog box that automatically imports the attached template styles.
|
|
#3
|
||||
|
||||
|
Quote:
John9210: All you need is a macro like: Code:
Sub UpdateDocumentStyles()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
'Copies all styles from the attached template into the document,
'overwriting any existing styles in the document that have the same name.
.UpdateStyles
'Resets all existing styles in the document to match the styles in the
'attached template each time the document is opened.
'.UpdateStylesOnOpen = True
.Close SaveChanges:=True
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VBA Word - Find & Apply Styles to Specific Words - Using Case Statement | jc491 | Word VBA | 17 | 12-26-2015 12:25 PM |
| Apply styles in word table | 1van | Word VBA | 2 | 11-17-2015 11:05 AM |
| Help - Need Macro to Apply Blur | SSL | PowerPoint | 6 | 07-26-2015 08:59 AM |
| Paragraph space before - can styles apply it intelligently? | timpani | Word | 7 | 10-23-2012 04:08 PM |
| Why can't I change certain styles back to normal? | SuperHans | Word | 1 | 10-16-2009 03:57 AM |