Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

Editing the target or multiple hyperlinks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LWhite - 11 Oct 2007 15:16 GMT
I have a large group of files that will all exist in a single folder. I want
to open each document. Go through and change every hyperlink by deleting the
first portion of the link. Then save the document, close the document and
move on to the next one in the folder.

What this is doing is changing the hyperlinks from fully qualified to
relative. Let me  give this as an example. Every hyperlink in every doc is
the same and looks like this.

http://servername/applicationname/appname.exe/open/docID#

I  want them to all go to

/applicationname/appname.exe/open/docid#

Each Document ID number is unique. The portion to remove is acutally 33
characters. This will allow for users on different servers to view the
documents without authenticating  to another server.

Thanks for all of your help.
LWhite
Jonathan West - 11 Oct 2007 16:06 GMT
>I have a large group of files that will all exist in a single folder. I
>want
[quoted text clipped - 16 lines]
> characters. This will allow for users on different servers to view the
> documents without authenticating  to another server.

A document has a Hyperlinks collection, of all the Hyperlink objects in the
document. A Hyperlink object has an Address property and a Subaddress
property. The Address is the portion to the left of the # and the Subaddress
is the portion to the right. A link to another location in the same document
will have a blank Address. A link to the start of another document will have
a blank Subaddress.

You can both read and write the Address property of a Hyperlink object. So
what you need to do is cycle through the Hyperlinks using a For Each-Next
loop, read the address, change it as necessary and write it back. Write some
code that does that on a single document. Then put the code into the inner
loop of the macro shown in article below in order to make a batch process of
it, replacing the find/replace code that is already there.

Find & ReplaceAll on a batch of documents in the same folder
http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.