2

I want to use a font i.e. Candara for text and at the same time, I want to use some other font for numbers in the text because the number style in the font Candara is somehow disturbing (at least for me). I don't want to change fonts again and again while writing text and numbers.

Is it possible to use Candara font for text and some other font for numbers simultaneously (with out changing font again and again).

Dave
  • 25,513
maliks
  • 167

1 Answers1

1

This can be done with VBa. Depending on the size of your file (how many words you have) it may be slow.

It also assumes that you only use 2 fonts. If you use other fonts, it will overwrite them!!

It's VBa so remember, save it first to create a back up (there is no undo)

Sub updateFont()

Dim doc As Document
Set doc = ActiveDocument
Dim i As Integer    
For i = 1 To doc.Range.Characters.Count

     If IsNumeric(doc.Range.Characters(i)) Then
        doc.Range.Characters(i).Font.Name = "Algerian"
        Else
        doc.Range.Characters(i).Font.Name = "Verdana"
     End If
Next i

End Sub

Screenshot before (using an italic font) enter image description here

and after

enter image description here

How do I add VBA in MS Office?

Dave
  • 25,513