![]() |
|
#1
|
|||
|
|||
|
I am trying to replace font Arial with Calibri on multiple docx files on folders+subfolders. This code I found it's not working on subfolders. Can anyone, please, help to add this part? Code:
Sub BatchReplaceFont()
Dim objDoc As Document
Dim objSingleWord As Range
Dim strFile As String, strFolder As String
strFolder = "C:\Users\Test\Desktop\test files\"
strFile = Dir(strFolder & "*.docx", vbNormal)
While strFile <> ""
Set objDoc = Documents.Open(FileName:=strFolder & strFile)
For Each objSingleWord In objDoc.Words
If objSingleWord.Font.Name = "Arial" Then
objSingleWord.Font.Name = "Calibri"
End If
Next objSingleWord
objDoc.Save
objDoc.Close
strFile = Dir()
Wend
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Replace or apply new header in multiple files
|
Carchee | Word VBA | 42 | 07-10-2024 08:47 AM |
Replace lines of text from header in multiple files
|
PolarPop | Word VBA | 6 | 05-27-2022 01:43 PM |
| Replace all Images with ordinal numbers in multiple files | beginner | Word | 0 | 09-19-2021 02:19 AM |
| Find and replace header text across multiple files | LG1972 | Excel | 1 | 12-25-2018 04:27 AM |
Macro to Find & Replace Font formats for Multiple Values
|
GemBox | Word | 6 | 03-12-2018 05:24 AM |