Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Ky Chapple Ky Chapple is offline
external usenet poster
 
Posts: 2
Default How to Find and Replace the Hyperlink Property of Text in Word 200

I am trying to replace the Hyperlink address that has been added to text.
So, the URL is not directly viewable in the document; it is the Hyperlink
property on some text. I'm trying to change the URL address of all
occurrences in the document from one URL to another. Similar to finding and
replacing text in a document...this text just happens to be the Hyperlink
property added to a text string.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How to Find and Replace the Hyperlink Property of Text in Word 200

Use a macro something like this (you would need to change if for
Hyperlinks):

' Macro created 26/10/01 by Doug Robbins to update links in a document
'
Dim alink As Field, linktype As Range, linkfile As Range
Dim linklocation As Range, i As Integer, j As Integer, linkcode As Range
Dim Message, Title, Default, Newfile
Dim counter As Integer

counter = 0
For Each alink In ActiveDocument.Fields
If alink.Type = wdFieldLink Then
Set linkcode = alink.Code
i = InStr(linkcode, Chr(34))
Set linktype = alink.Code
linktype.End = linktype.Start + i
j = InStr(Mid(linkcode, i + 1), Chr(34))
Set linklocation = alink.Code
linklocation.Start = linklocation.Start + i + j - 1
If counter = 0 Then
Set linkfile = alink.Code
linkfile.End = linkfile.Start + i + j - 1
linkfile.Start = linkfile.Start + i
Message = "Enter the modified path and filename following this
Format " & linkfile
Title = "Update Link"
Default = linkfile
Newfile = InputBox(Message, Title, Default)
End If
linkcode.Text = linktype & Newfile & linklocation
counter = counter + 1
End If
Next alink


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Ky Chapple" wrote in message
...
I am trying to replace the Hyperlink address that has been added to text.
So, the URL is not directly viewable in the document; it is the Hyperlink
property on some text. I'm trying to change the URL address of all
occurrences in the document from one URL to another. Similar to finding
and
replacing text in a document...this text just happens to be the Hyperlink
property added to a text string.


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How to Find and Replace the Hyperlink Property of Text in Word 200

Maybe a better way is to use Alt+F9 to display all of the field codes in the
document and then you can use EditReplace

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Ky Chapple" wrote in message
...
I am trying to replace the Hyperlink address that has been added to text.
So, the URL is not directly viewable in the document; it is the Hyperlink
property on some text. I'm trying to change the URL address of all
occurrences in the document from one URL to another. Similar to finding
and
replacing text in a document...this text just happens to be the Hyperlink
property added to a text string.


  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Ky Chapple Ky Chapple is offline
external usenet poster
 
Posts: 2
Default How to Find and Replace the Hyperlink Property of Text in Word

Hi Doug,

This worked and much easier than going down the potential path of having to
write a macro (which was probably doable, just was hoping it would not have
been needed - which looks like it was not).

So, thank you for your tip/help...much appreciated.

Ky.

"Doug Robbins - Word MVP" wrote:

Maybe a better way is to use Alt+F9 to display all of the field codes in the
document and then you can use EditReplace

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Ky Chapple" wrote in message
...
I am trying to replace the Hyperlink address that has been added to text.
So, the URL is not directly viewable in the document; it is the Hyperlink
property on some text. I'm trying to change the URL address of all
occurrences in the document from one URL to another. Similar to finding
and
replacing text in a document...this text just happens to be the Hyperlink
property added to a text string.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
find & replace a word and change text color of found words Der Koalameister Microsoft Word Help 1 May 30th 08 08:02 PM
Find duplicate text using copy and paste, not Find and Replace aljulong Microsoft Word Help 1 December 27th 07 01:13 PM
How to make the file search to find files by "text or property"? Dima Microsoft Word Help 17 May 15th 07 01:30 PM
Find and replace Hidden text in word W Greene Microsoft Word Help 3 April 5th 07 12:35 PM
find/replace in between text [email protected] Microsoft Word Help 3 November 29th 05 08:35 PM


All times are GMT +1. The time now is 11:44 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"