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