-
I copied your code exactly, so the test was with "whatever" - but the hyperlinks in the message I was working from were correct. When I run the macro, it doesn't error but also doesn't change the hyperlinks. When I step through the macro using debugging, it gives me the error I put above.
In case it helps any, before posting I had found someone's example code that would modify a hyperlink that you highlight to select... below is my slightly-modified version:
Public Sub ModifyLink()
If ActiveInspector.EditorType = olEditorText Then
MsgBox "Can't add links to textual mail"
Exit Sub
End If
Dim objHTM As Object
Dim doc As Object
Dim sel As Object
Set objHTM = CreateObject("htmlfile")
Set doc = ActiveInspector.WordEditor
Set sel = doc.Application.Selection
doc.Hyperlinks.Add Anchor:=sel.Range, _
Address:="this%20has%20been%20disabled%20-%20please%20copy%20it%20to%20your%20browser", _
SubAddress:="", _
ScreenTip:="this%20has%20been%20disabled%20-%20please%20copy%20it%20to%20your%20browser", _
TextToDisplay:=sel.Text
End Sub
And it works - if I highlight a hyperlink and then run the macro, it replaces the address with the invalid text. I'm looking to expand this to modify all hyperlinks in a message.
Thanks again for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules