Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2019, 04:10 AM
gmayor's Avatar
gmayor gmayor is offline Macro for batch process Windows 10 Macro for batch process 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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for batch process Batch applying a macro to remove Header and Footer using Batch Auto Addin Edszx Word VBA 2 05-27-2019 11:16 PM
Batch re-naming twols26 Word VBA 7 06-16-2015 12:29 PM
Macro for batch process Process Automation saurabhlotankar Excel Programming 10 06-03-2015 05:50 PM
Macro for batch process Trying to create a macro to batch edit hyperlinks martinlest Excel Programming 5 01-09-2015 09:34 AM
Macro for batch process batch file romanticbiro Office 1 06-30-2014 06:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft