![]() |
|
#2
|
||||
|
||||
|
There is no function that will automate this, but you should be able to achieve it with a macro e.g.
Code:
Sub Macro1()
Dim oRng As Range
Dim sFind As String
Dim sAddr As String
Dim sPath As String
sFind = "(Xnnnn)" 'the text to find
sAddr = Mid(sFind, 2, Len(sFind) - 2) 'remove the brackets from the searched text
sPath = "folder\file " & sAddr & ".txt" 'assemble the link path
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(sFind)
oRng.Hyperlinks.Add oRng, sPath, , , sFind
oRng.End = oRng.Hyperlinks(1).Range.End
oRng.Collapse 0
Loop
End With
lbl_Exit:
Set oRng = Nothing
Exit Sub
End Sub
Note that I have not tested it with Word 2003, but I am pretty sure all the code examples worked in that version.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto Generate a MS Word table based on the amount of data | fordmuntsinger | Mail Merge | 0 | 06-28-2023 03:56 PM |
Auto generate X pages from input
|
lipatin | Word VBA | 12 | 06-01-2018 12:13 AM |
| HTML Links do not work in MS Word 2003 | mswny | Word | 20 | 10-11-2014 02:25 PM |
| Auto Generate Invoice Number Word 2013 | Jonah245 | Word VBA | 3 | 09-04-2014 05:24 PM |
| Word 2003 OLE links | ctreharne | Word | 1 | 03-30-2014 04:13 PM |