I have the following code, and it's not executing due to an error message that reads "Method 'Execute' of object 'IRegExp2 failed"
Dim wrksht As Worksheet
Dim pg As Page
Dim regEx As New VBScript_RegExp_55.RegExp
For Each wrksht In Worksheets
For Each pg In wrksht.PageSetup.pages
With regEx
.IgnoreCase = True
.Pattern = "[(ftp|FTP|http|HTTP|s|S)]{3,5}*[\:/]{3}*[a-zA-Z0-9\s]{2,}[\.]*[.A-Za-z0-9\s]{2,}"
End With
If regEx.Execute(pg.CenterFooter.Text) Then
pg.CenterFooter.Text = regEx.Replace(pg.CenterFooter.Text, "")
End If
Next pg
Next wrksht
I'm looking to replace the beginning part of URLs (www.sampleurl.com/subfolder/testfile.pdf) and keeping only the trailing part (www.sampleurl.com /subfolder/testfile.pdf, minus the space after the .com part)