Sub SetFoundText2Bold()
Dim objItem As Object
Set objItem = Application.ActiveInspector.CurrentItem
Dim objInsp As Outlook.Inspector
Set objInsp = objItem.GetInspector
Dim objDoc As Word.Document
Set objDoc = objInsp.WordEditor
Dim objWord As Word.Application
Set objWord = objDoc.Application
Dim objSelect As Word.Selection
Set objSelect = objWord.Selection
Dim objRegExp As RegExp
Set objRegExp = New RegExp
Dim objMatches As MatchCollection
Dim objMatch As Variant
With objRegExp
.MultiLine = True
.Global = True
.IgnoreCase = True
.Pattern = "\d{2,4}-\d{2,4}-\d{2,4}"
End With
If (objRegExp.Test(objSelect.Text) = True) Then
Set objMatches = objRegExp.Execute(objSelect.Text) ' Execute search
For Each objMatch In objMatches
With objSelect.Find
.Text = objMatch
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceOne
End With
Next
End If
End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Expert of the Year award recognizes an expert who helped improve Experts Exchange in the past year through high levels of contributions and participation on site. This award is given to the expert who has achieved the highest levels of participation, while maintaining quality contributions and professionalism.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.