View Single Post
 
Old 10-18-2019, 04:10 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following will work. It needs a small change to your macro

Code:
Sub BatchProcess()
Dim strFile As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
    Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
    With fDialog
        .TITLE = "Select folder and click OK"
        .AllowMultiSelect = False
        .InitialView = msoFileDialogViewList
        If .Show <> -1 Then
            MsgBox "Cancelled By User", , "List Folder Contents"
            Exit Sub
        End If
        strPath = fDialog.SelectedItems.Item(1)
        Do Until Right(strPath, 1) = "\"
            strPath = strPath + "\"
        Loop
    End With
    strFile = Dir$(strPath & "*.doc")
    While strFile <> ""
        Set oDoc = Documents.Open(strPath & strFile)
        Macro1 oDoc
        oDoc.Close SaveChanges:=wdSaveChanges
        strFile = Dir$()
    Wend
lbl_Exit:
    Exit Sub
End Sub

Private Sub Macro1(oDoc As Document)
    With oDoc.Styles("Normal").Font
        .NameFarEast = "Calibri"
    End With
    With oDoc.Styles("Normal")
        .AutomaticallyUpdate = False
        .BaseStyle = ""
        .NextParagraphStyle = "Normal"
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote