View Single Post
 
Old 10-10-2020, 01:25 PM
John 4 John 4 is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Oct 2019
Posts: 68
John 4 is on a distinguished road
Default

I was hoping (again. But i was actually hopeful this time), that the following version would be successful. Alas...

Code:
Sub UpdateDocuments()
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 & "\*.docx", vbNormal)
While strFile <> ""
  If strFolder & "" & strFile <> strDocNm Then
    Set wdDoc = Documents.Open(FileName:=strFolder & "" & strFile, AddToRecentFiles:=False, Visible:=False)
        x = wdDoc.Path & Application.PathSeparator & wdDoc.Name
    With wdDoc

      'Call your other macro or insert its code here
        .UpdateStylesOnOpen = False
        .AttachedTemplate = "Normal"
    Application.OrganizerCopy Source:= _
        "C:\Users\MyName\AppData\Roaming\Microsoft\Templates\Normal.dotm", _
        Destination:="x", Name:="Default", Object:=wdOrganizerObjectStyles

      .Close SaveChanges:=True
    End With
  End If
  strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Reply With Quote