![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#4
|
||||
|
||||
|
Try this code
Code:
Sub MakeMyLink()
Dim aRng As Range, sFound() As String, sLink As String, sText As String
Set aRng = ActiveDocument.Range
With aRng.Find
.Text = "\<\<(*)\>\>\<\<(*)\>\>"
.MatchWildcards = True
.Replacement.Text = "\1|\2"
Do While .Execute
sFound = Split(aRng.Text, ">><<")
sLink = Replace(sFound(0), "<<", "")
sText = Replace(sFound(1), ">>", "")
ActiveDocument.Hyperlinks.Add Anchor:=aRng, Address:=sLink, TextToDisplay:=sText
aRng.Collapse Direction:=wdCollapseEnd
Loop
End With
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
| Tags |
| hyperlinking, macro find text |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Macro how to add hyperlink to text in document | hullsquashboy | Word VBA | 32 | 06-28-2022 06:30 PM |
| Highlighting applied to range ending in a paragraph continues to apply to text added after | Peterson | Word VBA | 2 | 10-08-2018 02:50 PM |
Word changing my body text to heading text when I apply paragraph numbering
|
ddiemetric | Word | 1 | 01-17-2017 01:10 PM |
| Microsoft Word macro to find text, select all text between brackets, and delete | helal1990 | Word VBA | 4 | 02-05-2015 03:52 PM |
Formatting- Apply changes to highlighted text results in same change to other text
|
sential | Word | 6 | 01-10-2014 03:22 PM |