Hello,
When you post code, it is helpful to simply post a snippet of the part that doesn't work. That way we don't have to try to recreate your entire situation (create and excel file etc.).
Try:
Code:
Sub format_scientific_names()
Dim oRng As Range
Dim strFind As String
strFind = "Hyla cinerea"
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = strFind
.Forward = True
.Wrap = wdFindStop
.MatchCase = False
While .Execute
oRng.Font.Italic = True
oRng.Font.Bold = True
oRng.Font.Color = RGB(200, 187, 0)
oRng.Font.Name = "Times New Roman"
oRng.Case = wdLowerCase
oRng.Words(1).Characters(1).Case = wdUpperCase
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub
Or you could simply use your Excel file "Find" phrase as the replacement text:
Code:
Sub format_scientific_names()
Dim oRng As Range
Dim strFind As String
strFind = "Hyla cinerea"
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = strFind
.Forward = True
.Wrap = wdFindStop
.MatchCase = False
While .Execute
oRng.Text = strFind
oRng.Font.Italic = True
oRng.Font.Bold = True
oRng.Font.Color = RGB(200, 187, 0)
oRng.Font.Name = "Times New Roman"
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub