I'm trying to search through a word document and replace regex matches with a series of static hyperlinks.
For example, if I get a regex match for "A-1", I want to replace the "A-1" string with a hyperlink with Anchor = "A-1" and Address = "https://www.my_website.com/A-1". My RegEx matches could be "A-1", "A-2", "A-3", etc.
I'm familiar with RegEx but I'm very new to VBA. What I have so far:
Sub FindAndHyperlink()
Dim RegEx As Object
Set RegEx = CreateObject("VBScript.RegExp")
RegEx.Global = True
RegEx.Pattern = "([A][\-])([0-9])"
Set Matches = RegEx.Execute(ActiveDocument.Range.Text)
For Each Match In Matches
ActiveDocument.Range.Text = RegEx.Replace(ActiveDocument.Range.Text, (ActiveDocument.Hyperlinks.Add Anchor:=Match, Address:="https://www.my_website.com/" & Match))
Next
End Sub
This doesn't compile because it's expecting a ) after ActiveDocument.Hyperlinks.Add.
I think the problem is that the RegEx.Replace() method is expecting (String, String) arguments rather than (String, Hyperlink object), but I'm not sure the best way to get around that.
Any help would be appreciated.

Match.Rangeand then instead add the hyperlink at the location of theMatch.Range- Marcucciboy2Matchesactually receive a range fromRegEx.Executeof each match for that regex? - Marcucciboy2