PDA

View Full Version : Text font change in VBA



vansit
07-22-2020, 02:26 AM
Dear all
I have problem with my document, I type my word document with caribri font but now I want to change only numberic in to Time New Roman font so is there any way to change all numberic font.
anyone can help me please!

gmaxey
07-22-2020, 06:13 AM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "([$.,0-9]{1,})"
.MatchWildcards = True
While .Execute
oRng.Font.Name = "Times New Roman"
Wend
End With
lbl_Exit:
Exit Sub
End Sub

Chas Kenyon
07-22-2020, 11:22 AM
Hi Greg,
Just curious.
Will this replace numbers generated by list numbering? by fields? or only typed text?

I tried it and it changed the number generated by a SEQ field without any FORMAT switch. It did not change a list number.
It may be all Vansit needs.