Mass change hyperlink strings, or use a variable in the hyperlink?

G

Guest

I have an MS-Word document that has many hyperlinks embedded in it. All of
the underlying hyperlink strings include the same 4-digit number. I need to
mass change that 4-digit number. Or, maybe embed a variable or a property in
place of the number, and just change the value of the property. Any
suggestions?

For example, two hyperlinks embedded in the document could be:
...\folder1\9999_file1.doc
...\folder2\9999_file2.xls

I need to change all "9999" to "1234". Or, replace "9999" with a property
or variable, and just edit the value of the variable. I can manually edit
all hyperlinks, but it is very time consuming, and I need to do this
periodically.
 
J

Jezebel

Two approaches you could use ---

1. Display field codes, then use Find and Replace. Will work fine provided
the string you're looking for doesn't otherwise occur in your document.

2. Use a nested field, with a docproperty for the variable bit. --

{ HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty FileID }"_file1.doc" }}

Where FileID (or whatever name you want) is defined on File > Properties >
Custom.
 
G

Guest

Jezebel,

Thanks for your very quick response. I tried both suggestions and failed.
I'm probably missing something.

On (1): I used alt+F9 to display field codes. I could then see links
displayed as:
{HYPERLINK "folder1/9999_file1.doc"}
Then I used find/replace to find "9999" and replace with "1234"
In that view, the hyperlink display changed to:
{HYPERLINK "folder1/1234_file1.doc"}
Then I used alt+F9 to return to normal view.
But the link still is associated with "9999", based on what I see when I
hover and when I click the link.

On (2): I have never used fields before. I assumed I should put the cursor
where I want the hyperlink to be, then click "insert>field". I do not see at
that point how I can input { HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty
FileID }"_file1.doc" }}

What am I missing?

Rookie Bob


2. Use a nested field, with a docproperty for the variable bit. --

{ HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty FileID }"_file1.doc" }}


--
Bob Zoller

Jezebel said:
Two approaches you could use ---

1. Display field codes, then use Find and Replace. Will work fine provided
the string you're looking for doesn't otherwise occur in your document.

2. Use a nested field, with a docproperty for the variable bit. --

{ HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty FileID }"_file1.doc" }}

Where FileID (or whatever name you want) is defined on File > Properties >
Custom.
 
S

Suzanne S. Barnhill

You have to do it more than one way, and you have to update fields; see
http://sbarnhill.mvps.org/WordFAQs/HyperlinkProbs.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Bob Zoller said:
Jezebel,

Thanks for your very quick response. I tried both suggestions and failed.
I'm probably missing something.

On (1): I used alt+F9 to display field codes. I could then see links
displayed as:
{HYPERLINK "folder1/9999_file1.doc"}
Then I used find/replace to find "9999" and replace with "1234"
In that view, the hyperlink display changed to:
{HYPERLINK "folder1/1234_file1.doc"}
Then I used alt+F9 to return to normal view.
But the link still is associated with "9999", based on what I see when I
hover and when I click the link.

On (2): I have never used fields before. I assumed I should put the cursor
where I want the hyperlink to be, then click "insert>field". I do not see at
that point how I can input { HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty
FileID }"_file1.doc" }}

What am I missing?

Rookie Bob


2. Use a nested field, with a docproperty for the variable bit. --

{ HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty FileID }"_file1.doc" }}
 
J

Jezebel

To get the nested fields right, work from the inside out.

Start with the DocProperty field. Update it and make sure it displays 9999.

Now create the Quote field. Copy the Docproperty field and insert it into
the Quote field. Update that and check that the result is the filename.

Now create the Hyperlink field. Copy the Quote field and paste that into it.





Bob Zoller said:
Jezebel,

Thanks for your very quick response. I tried both suggestions and failed.
I'm probably missing something.

On (1): I used alt+F9 to display field codes. I could then see links
displayed as:
{HYPERLINK "folder1/9999_file1.doc"}
Then I used find/replace to find "9999" and replace with "1234"
In that view, the hyperlink display changed to:
{HYPERLINK "folder1/1234_file1.doc"}
Then I used alt+F9 to return to normal view.
But the link still is associated with "9999", based on what I see when I
hover and when I click the link.

On (2): I have never used fields before. I assumed I should put the
cursor
where I want the hyperlink to be, then click "insert>field". I do not see
at
that point how I can input { HYPERLINK { QUOTE "..\\folder1\\"{
DocProperty
FileID }"_file1.doc" }}

What am I missing?

Rookie Bob


2. Use a nested field, with a docproperty for the variable bit. --

{ HYPERLINK { QUOTE "..\\folder1\\"{ DocProperty FileID }"_file1.doc" }}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top