View Single Post
 
Old 09-18-2024, 04:14 AM
w64bit w64bit is offline Windows 10 Office 2021
Novice
 
Join Date: Jan 2015
Posts: 19
w64bit is on a distinguished road
Default Replace font in Normal Style

I tried to change this code to replace the Normal Style font when it's Arial to Calibri, but I cannot make it work.
I am using it with Batch Process Documents 4.9 (Graham Mayor).
Can you please give me a little help?
Thank you
Code:
Function ChangeFont(oDoc As Document) As Boolean
Dim oStory As Range
    On Error GoTo err_Handler
    For Each oStory In oDoc.StoryRanges
        oStory.Font.Name = "Arial"
        If oStory.StoryType <> wdMainTextStory Then
            While Not (oStory.NextStoryRange Is Nothing)
                Set oStory = oStory.NextStoryRange
                oStory.Font.Name = "Calibri"
            Wend
        End If
    Next oStory
    Set oStory = Nothing
    ChangeFont = True
lbl_Exit:
    Exit Function
err_Handler:
    ChangeFont = False
    Resume lbl_Exit
End Function
Reply With Quote