Changing Multiple Hyperlinks in Word 2007

D

dblee50

I have a large document with tables that list a 3 or 4 digit code that
refers to an equipment item. In years past, I created hyperlinks
that, when clicked on, take the viewer to a picture of that item. The
pictures are located in another folder but in the same folder as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg. Worked
fine until this year. Now when clicked on the link it can't find the
pictures cause the reference is wrong. When I hover over the link, it
reads something like, /Documents and Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on the link
and edit, I can change it and all works ok, it's just that I have a
thousand links and I would really like to automate this. Nothing I
have tried has worked and I just don't know enough about VBA to
program this.When I use Alt+F9 I could change multiple links, but when
I went back to the normal view it would not change the link info.
Short of manually updating each link, can anybody help? thanks
 
D

Doug Robbins - Word MVP

Try using the following.

' 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
 
D

dblee50

Try using the following.

' 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 filenamefollowing 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

Thanks, but no luck. I couldn't get the Doug Robbins macro to do
anything (probably didn't know how to do it) and macropod's fieldlink
updater I couldn't figure out either. thanks for the attempt, but I
don't have any experience with macros other than recording and running.
 
D

Doug Robbins - Word MVP

Did you get the macro installed?

If not, see the article "What do I do with macros sent to me by other
newsgroup readers to help me out?" at:
http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm


--
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
 
D

dblee50

Did you get the macro installed?

If not, see the article "What do I do with macros sent to me by other
newsgroup readers to help me out?" at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

--
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


Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but it is simply
a word document with a table that has a column with four digit numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
 
D

Doug Robbins - Word MVP

If you press Alt+F9 to toggle on the display of the fields in the document,
what type of fields are they?

--
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
 
D

dblee50

If you press Alt+F9 to toggle on the display of the fields in the document,
what type of fields are they?

--
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

It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
 
D

Doug Robbins - Word MVP

In the macro that I sent to you, change the line

If alink.Type = wdFieldLink Then

to

If alink.Type = wdFieldHyperlink Then


--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?

--
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

It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
 
D

dblee50

It shows hyperlink.  This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.

I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
 
M

macropod

Hi dblee50,

The code Doug and I provided was for changing the actual hyperlink, not the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something more meaningful than just a URL.

--
Cheers
macropod
[Microsoft MVP - Word]


It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.

I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
 
D

dblee50

Hi dblee50,

The code Doug and I provided was for changing the actual hyperlink, not the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something more meaningful than just a URL.

--
Cheers
macropod
[Microsoft MVP - Word]


It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.

I've tried to go to Alt-F9 to display hyperlink path and change it.  I
then update that field (F9) and try it to no avail.  It still shows
the old path when hovering over the link.

Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie. file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the (HYPERLINK "SE
%20Master%20Pictures/2272.jpg"). Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed. It
still shows 2272 and it still shows file:///C:\Documents and
Settin... Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod. Thanks again for your patience
 
D

Doug Robbins - Word MVP

Did you try using the macro that I sent to you with Link changed to
Hyperlink?

--
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

dblee50 said:
Hi dblee50,

The code Doug and I provided was for changing the actual hyperlink, not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something more
meaningful than just a URL.

--
Cheers
macropod
[Microsoft MVP - Word]

message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
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
On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
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
On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' 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
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
I have a large document with tables that list a 3 or 4 digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of that
item.
The
pictures are located in another folder but in the same folder
as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it can't
find
the
pictures cause the reference is wrong. When I hover over the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on
the link
and edit, I can change it and all works ok, it's just that I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about VBA
to
program this.When I use Alt+F9 I could change multiple links,
but
when
I went back to the normal view it would not change the link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro to do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the attempt,
but I
don't have any experience with macros other than recording and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but it is
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.

I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.

Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie. file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the (HYPERLINK "SE
%20Master%20Pictures/2272.jpg"). Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed. It
still shows 2272 and it still shows file:///C:\Documents and
Settin... Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod. Thanks again for your patience
 
D

dblee50

Did you try using the macro that I sent to you with Link changed to
Hyperlink?

--
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


Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink, not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself ofmy
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourselfof
my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via
msnews.microsoft.com

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' 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

I have a large document with tables that list a 3 or 4 digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of that
item.
The
pictures are located in another folder but in the same folder
as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it can't
find
the
pictures cause the reference is wrong. When I hover over the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on
the link
and edit, I can change it and all works ok, it's just thatI
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about VBA
to
program this.When I use Alt+F9 I could change multiple links,
but
when
I went back to the normal view it would not change the link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro todo
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the attempt,
but I
don't have any experience with macros other than recording and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but it is
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown..
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it.  I
then update that field (F9) and try it to no avail.  It still shows
the old path when hovering over the link.
Sorry, I may have not been clear in previous post.  I do not want to
change the display text, if the display text is what you see in the
document when reading.  It is correct.  Foe example, when I look ata
cell in the table that has this link, I see a number, ie. 2272.  That
number is a hyperlink.  That's what it should look like.  If I place
my cursor over this number it reveals the path, ie.  file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg.  But if I use Alt-F9 it shows the  (HYPERLINK "SE
%20Master%20Pictures/2272.jpg").  Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed.  It
still shows 2272 and it still shows  file:///C:\Documents and
Settin...  Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod.  Thanks again for your patience

No, I'm afraid not. Do you mean change alink to ahyperlink,
alink.Type to ahyperlink.Type and so on? Sorry, but I just don't know
which words containing link should be changed to hyperlink. thanks
 
D

Doug Robbins - Word MVP

No, I said

In the macro that I sent to you, change the line

If alink.Type = wdFieldLink Then

to

If alink.Type = wdFieldHyperlink Then


--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

Did you try using the macro that I sent to you with Link changed to
Hyperlink?

--
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


Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink, not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something
more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
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

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
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

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' 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

I have a large document with tables that list a 3 or 4
digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of that
item.
The
pictures are located in another folder but in the same
folder
as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it can't
find
the
pictures cause the reference is wrong. When I hover over
the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on
the link
and edit, I can change it and all works ok, it's just that
I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about
VBA
to
program this.When I use Alt+F9 I could change multiple
links,
but
when
I went back to the normal view it would not change the link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro to
do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the attempt,
but I
don't have any experience with macros other than recording and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but it is
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie. file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the (HYPERLINK "SE
%20Master%20Pictures/2272.jpg"). Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed. It
still shows 2272 and it still shows file:///C:\Documents and
Settin... Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod. Thanks again for your patience

No, I'm afraid not. Do you mean change alink to ahyperlink,
alink.Type to ahyperlink.Type and so on? Sorry, but I just don't know
which words containing link should be changed to hyperlink. thanks
 
D

dblee50

No, I said

In the macro that I sent to you, change the line

 If alink.Type = wdFieldLink Then

to

 If alink.Type = wdFieldHyperlink Then

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my serviceson
a paid professional basis.


Did you try using the macro that I sent to you with Link changed to
Hyperlink?
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
Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink, not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something
more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
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

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
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

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' 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

I have a large document with tables that list a 3 or 4
digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of that
item.
The
pictures are located in another folder but in the same
folder
as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it can't
find
the
pictures cause the reference is wrong. When I hover over
the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on
the link
and edit, I can change it and all works ok, it's just that
I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about
VBA
to
program this.When I use Alt+F9 I could change multiple
links,
but
when
I went back to the normal view it would not change the link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro to
do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the attempt,
but I
don't have any experience with macros other than recording and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but it is
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie. file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the (HYPERLINK "SE
%20Master%20Pictures/2272.jpg"). Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed. It
still shows 2272 and it still shows file:///C:\Documents and
Settin... Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod. Thanks again for your patience

No, I'm afraid not.  Do you mean change alink to ahyperlink,
alink.Type to ahyperlink.Type and so on?  Sorry, but I just don't know
which words containing link should be changed to hyperlink.  thanks

Progress! I did as you said and ran the macro and it executed. Asked
me for path and I tried a path, but each link has a different picture
referenced and it changed all the links to the same jpg number. Can I
use wildcards or the like to keep the particular jpg with it's own
link?
 
D

Doug Robbins - Word MVP

Maybe the code I posted was created for some other purpose. Maybe you can
just use Ctrl+F9 to reveal the codes and then copy and paste the part that
needs to be changed into the find what control of the Edit>Replace dialog
and then enter the required replacement into the Replace with Control and
then click on Replace All.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

No, I said

In the macro that I sent to you, change the line

If alink.Type = wdFieldLink Then

to

If alink.Type = wdFieldHyperlink Then

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services
on
a paid professional basis.


Did you try using the macro that I sent to you with Link changed to
Hyperlink?
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
Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink,
not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something
more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
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

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me
by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
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

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' 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

I have a large document with tables that list a 3 or 4
digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of
that
item.
The
pictures are located in another folder but in the same
folder
as the
large document, ie. E:\large.doc and
E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it
can't
find
the
pictures cause the reference is wrong. When I hover over
the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click
on
the link
and edit, I can change it and all works ok, it's just
that
I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about
VBA
to
program this.When I use Alt+F9 I could change multiple
links,
but
when
I went back to the normal view it would not change the
link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro
to
do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the
attempt,
but I
don't have any experience with macros other than recording
and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type =
wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach
a
test doc to show what I have and what I trying to do, but it is
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the
same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing
this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is
shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie.
file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the (HYPERLINK "SE
%20Master%20Pictures/2272.jpg"). Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed. It
still shows 2272 and it still shows file:///C:\Documents and
Settin... Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod. Thanks again for your patience

No, I'm afraid not. Do you mean change alink to ahyperlink,
alink.Type to ahyperlink.Type and so on? Sorry, but I just don't know
which words containing link should be changed to hyperlink. thanks

Progress! I did as you said and ran the macro and it executed. Asked
me for path and I tried a path, but each link has a different picture
referenced and it changed all the links to the same jpg number. Can I
use wildcards or the like to keep the particular jpg with it's own
link?
 
M

macropod

Hi dblee50,

The link I pointed you to has a utility for making the change. It changes only the (hyper)links - not the filenames or the hyperlink
display text.

--
Cheers
macropod
[Microsoft MVP - Word]


No, I said

In the macro that I sent to you, change the line

If alink.Type = wdFieldLink Then

to

If alink.Type = wdFieldHyperlink Then

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.


Did you try using the macro that I sent to you with Link changed to
Hyperlink?
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
Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink, not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something
more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
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

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
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

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' 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

I have a large document with tables that list a 3 or 4
digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of that
item.
The
pictures are located in another folder but in the same
folder
as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it can't
find
the
pictures cause the reference is wrong. When I hover over
the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on
the link
and edit, I can change it and all works ok, it's just that
I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about
VBA
to
program this.When I use Alt+F9 I could change multiple
links,
but
when
I went back to the normal view it would not change the link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro to
do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the attempt,
but I
don't have any experience with macros other than recording and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but it is
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie. file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the (HYPERLINK "SE
%20Master%20Pictures/2272.jpg"). Again, if I attempt to alter the
revealed code, then press F9 to update, then Alt-F9 to go back to
normal view, when I hover over the link, nothing has changed. It
still shows 2272 and it still shows file:///C:\Documents and
Settin... Unless I can change this part the link won't work right.
The only way that appears to work is to edit the hyperlink manually,
but that is what I'm trying to aviod. Thanks again for your patience

No, I'm afraid not. Do you mean change alink to ahyperlink,
alink.Type to ahyperlink.Type and so on? Sorry, but I just don't know
which words containing link should be changed to hyperlink. thanks

Progress! I did as you said and ran the macro and it executed. Asked
me for path and I tried a path, but each link has a different picture
referenced and it changed all the links to the same jpg number. Can I
use wildcards or the like to keep the particular jpg with it's own
link?
 
D

dblee50

Maybe the code I posted was created for some other purpose.  Maybe you can
just use Ctrl+F9 to reveal the codes and then copy and paste the part that
needs to be changed into the find what control of the Edit>Replace dialog
and then enter the required replacement into the Replace with Control and
then click on Replace All.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my serviceson
a paid professional basis.


No, I said
In the macro that I sent to you, change the line
If alink.Type = wdFieldLink Then

If alink.Type = wdFieldHyperlink Then
Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to obtain my services
on
a paid professional basis.
Did you try using the macro that I sent to you with Link changed to
Hyperlink?
--
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

Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink,
not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something
more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
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

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me
by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
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

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' Macro created 26/10/01 by Doug Robbins to update linksin
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

I have a large document with tables that list a 3 or 4
digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture of
that
item.
The
pictures are located in another folder but in the same
folder
as the
large document, ie. E:\large.doc and
E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it
can't
find
the
pictures cause the reference is wrong. When I hover over
the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click
on
the link
and edit, I can change it and all works ok, it's just
that
I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about
VBA
to
program this.When I use Alt+F9 I could change multiple
links,
but
when
I went back to the normal view it would not change the
link
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro
to
do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the
attempt,
but I
don't have any experience with macros other than recording
and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type =
wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach
a
test doc to show what I have and what I trying to do, but itis
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the
same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing
this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is
shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it.. I
then update that field (F9) and try it to no avail. It still shows
the old path when

...

read more »

thanks for the help. Doug, your macro worked well except that it
changed all the links to the same picture.
 
D

dblee50

Hi dblee50,

The link I pointed you to has a utility for making the change. It changesonly the (hyper)links - not the filenames or the hyperlink
display text.

--
Cheers
macropod
[Microsoft MVP - Word]


No, I said
In the macro that I sent to you, change the line
If alink.Type = wdFieldLink Then

If alink.Type = wdFieldHyperlink Then
Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
Did you try using the macro that I sent to you with Link changed to
Hyperlink?
--
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

Hi dblee50,
The code Doug and I provided was for changing the actual hyperlink, not
the display text - you didn't ask about that. Generally
speaking, the better practice is to make the display text something
more
meaningful than just a URL.
--
Cheers
macropod
[Microsoft MVP - Word]
message
On Dec 15, 1:35 pm, "Doug Robbins - Word MVP"
If you press Alt+F9 to toggle on the display of the fields in the
document,
what type of fields are they?
--
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

On Dec 15, 3:58 am, "Doug Robbins - Word MVP"
Did you get the macro installed?
If not, see the article "What do I do with macros sent to me by
other
newsgroup readers to help me out?"
at:http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
--
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

On Dec 14, 1:33 pm, "Doug Robbins - Word MVP"
Try using the following.
' Macro created 26/10/01 by Doug Robbins to update linksin 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

I have a large document with tables that list a 3 or 4
digit
code
that
refers to an equipment item. In years past, I created
hyperlinks
that, when clicked on, take the viewer to a picture ofthat
item.
The
pictures are located in another folder but in the same
folder
as the
large document, ie. E:\large.doc and E:\Pictures\0001.jpg.
Worked
fine until this year. Now when clicked on the link it can't
find
the
pictures cause the reference is wrong. When I hover over
the
link,
it
reads something like, /Documents and
Settings/b1111111/Application
Data/Microsoft/Word/Pictures/0001.jpg. If I right click on
the link
and edit, I can change it and all works ok, it's just that
I
have a
thousand links and I would really like to automate this.
Nothing I
have tried has worked and I just don't know enough about
VBA
to
program this.When I use Alt+F9 I could change multiple
links,
but
when
I went back to the normal view it would not change thelink
info.
Short of manually updating each link, can anybody help?
thanks
Thanks, but no luck. I couldn't get the Doug Robbins macro to
do
anything (probably didn't know how to do it) and macropod's
fieldlink
updater I couldn't figure out either. thanks for the attempt,
but I
don't have any experience with macros other than recording and
running.
Thanks again. I did copy and paste macro in as your attachment
instructed. I had done the same before. This time I watched the
step
by step and when it gets to the line "If alink.Type = wdFieldLink
Then" it jumps to "End If" and then "Next alink" and repeats
without
anything else happening. It doesn't look as though I can attach a
test doc to show what I have and what I trying to do, but itis
simply
a word document with a table that has a column with four digit
numbers
that I have previously hyperlinked to another folder in the same
folder as the original doc. .
It shows hyperlink. This seems strange and is why just changing this
part when the (HYPERLINK "SE%20Master%20Pictures/2272.jpg") is shown.
If I Alt-F9 back to normal view where the blue underlined 2272 is
shown and hover over the link, it shows file:///C:\Documents and
Settings\myuserID\Application Data\Microsoft\Word\SE Master Pictures
\2272.jpg
That is, if Alt-=F9 and change the info, then change back, nothing
seems to change when hovering over link and it doesn't work.
I've tried to go to Alt-F9 to display hyperlink path and change it.. I
then update that field (F9) and try it to no avail. It still shows
the old path when hovering over the link.
Sorry, I may have not been clear in previous post. I do not want to
change the display text, if the display text is what you see in the
document when reading. It is correct. Foe example, when I look at a
cell in the table that has this link, I see a number, ie. 2272. That
number is a hyperlink. That's what it should look like. If I place
my cursor over this number it reveals the path, ie. file:///C:\Documents
and Settings\myuserID\Application Data\Microsoft\Word\SE Master
Pictures\2272.jpg. But if I use Alt-F9 it shows the

...

read more »

macropod, I've tried your macro just about every option and get an in
some instances it does change the link the way I need, it's just that
it also changes the viewed hyperlink (what you see when you read
document) from ie. 2272 to the full path making that a link,
ie.file///e:/...2272.jpg. This part is undesirable but I can' t
figure out how to keep the original intact.
 

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