Okay, So I have tried to develop a script for finding text in a particular font ("Segoe Script") and then updating that text to a Style (which has Arial font... but I wanted the option to change the styles in the future hense not a straight font change)
It's based on a macro record for the search - this proved unhelpful as I don't know how it selects or activates.
It runs without error but doesn't do anything.
Code:
Function FontStyle(oDoc As Document) As Boolean
Dim oSection As Section
On Error GoTo Err_Handler
'Do Something with oDoc here. e.g.,"
oDoc.Range.Find.ClearFormatting
With Range.Find
.Text = ""
.Font.Name = "Segoe Script"
.Replacement.Text = ""
.Replacement.Style = ActiveDocument.Styles("AsideStyle")
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Excecute Replace:=wdReplaceAll
End With
FontStyle = True
lbl_Exit:
Exit Function
Err_Handler:
FontStyle = False
Err.Clear
GoTo lbl_Exit
End Function
FYI This is the code which is created in the recorded Macro - Doesn't seem to even select the font in the recording.
Code:
Sub font()
'
' font Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("ASideStyle")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I've looked over so many other things to make a selection, but can't get anything to work. Any ideas?
:/