You may have noticed a Use Relative Path For Hyperlink check box in the Hyperlinks dialog box. If you’re very
observant, you may also have noticed that this check box is unavailable
if you haven’t yet saved your drawing, but is available and selected by
default if your current drawing has been saved. What’s this all about?
With Visio, you can build two types of links:
A relative link provides a path to a resource by assuming a known starting location.
As
an analogy in the physical world, let’s say you need to attend a
meeting in room 216 at Lucerne Publishing. If you’re standing at the
reception desk in the lobby of the company’s office and ask where the
meeting is located, the receptionist might say, “Go up to the second
floor and it’s the second door on the right.” Based on the known
starting location you share with the receptionist, the lobby, that
information is sufficient to get you to the intended location.
Relative
links in a Visio drawing work in a similar way. The folder containing
the Visio drawing serves as “the lobby,” and hyperlink targets on the
same disk drive are found relative to that starting point.
For
Visio drawings, relative links work very nicely when the relationship
between the starting point and the hyperlink targets remains fixed.
Problems can arise, however, if you need to move the Visio drawing file
to another computer or even to another
location on the same computer. In this case, you must preserve the
relative relationships from the new location of the Visio file to the
target folders and files. One way you can accomplish this is by copying
the entire directory structure containing the Visio drawing and its
hyperlink targets.
An absolute link contains all of the information required to locate a linked resource, regardless of the starting point.
Returning
to our meeting analogy, if you’re at home and need directions to the
conference room at Lucerne Publishing, you need a lot more information
to arrive at your destination. An absolute address for the meeting room
would look more like the following:
Lucerne Publishing, Room 216, 3456 Elm St., San Francisco, CA 94117 USA
Armed
with an absolute address, you can get to the meeting from your home, or
for that matter, from any starting location in the world.
For
Visio hyperlinks, absolute links work regardless of where your Visio
drawing is located. You can move the drawing to a different computer and
the links will continue to function without requiring any other
changes.
Tip:
Relative and absolute
hyperlinks are not mutually exclusive in a single drawing. In fact, many
Visio drawings contain a mix of the two link types.
What does all of this have to do with the check box in the Visio Hyperlinks dialog box?
For a saved drawing, Visio
assumes that the path to the target of a hyperlink begins in the same
folder that contains the Visio drawing. Thus, the default behavior in
Visio is to create a relative hyperlink using the location of your Visio
drawing as the starting point for the path. When someone clicks your
hyperlink, Windows figures out where the target object is by navigating
from the location of the Visio drawing.
Just knowing this much explains
why the Use Relative Path For Hyperlink check box is unavailable if you
haven’t yet saved your drawing—Visio can’t create a relative link yet
because there is no known starting point for the Visio drawing.
Consequently, the only option is to use an absolute path that contains
all of the information Windows will need to track down the target
object.
Although there are no
absolute guidelines on when to use relative links rather than absolute
links, it’s a good idea to think about your environment and the nature
of your document collection before creating very many links in Visio. If
all of your target documents are in their final resting place, on a
network server, for example, then absolute links probably make the most
sense. However, if your environment is more volatile, or you know in
advance that you’ll be moving your Visio drawing and its hyperlink
targets to another computer or to a CD or DVD, then carefully
constructed relative links are a good choice.
In addition to that advice, the following examples will help you to understand when Visio creates relative or absolute links.
Warning:
Important
When you use the Hyperlinks
dialog box to browse to and select a target document, Visio fills in the
Address box and selects the Use Relative Path For Hyperlink check box
based on the locations of the Visio drawing and the target document.
For the examples that follow, assume that the HR Process Maps
drawing, is saved in C:\Human Resources\Process Maps\ and that the
hyperlink target is one of the Word documents shown in the following
directory listing.
Tip:
The file name of each Word
document includes a parenthetical note to indicate whether it is in a
directory above or below the Visio document, or is in the same
directory.
When the target document is in the same folder as HR Process Maps.vsd,
which obviously means that it is on the same disk drive as the Visio
drawing, Visio creates a relative hyperlink and the Address box contains
the following:
MyDocument (same).docx
If
you now clear the Use Relative Path For Hyperlink check box, the link
becomes an absolute link that begins at the root of drive C. The Address
box displays the full path to the document:
C:\Human Resources\Process Maps\MyDocument (same).docx
When you link to a
document located in C:\Human Resources\Process Maps \Recruiting\, which
is a subfolder of the one containing the Visio drawing, Visio creates a
relative hyperlink and the Address box contains the following:
Recruiting\MyDocument (below).docx
This indicates that the target document is in a folder called Recruiting.
When the target
document is located in C:\Human Resources\, which is above the folder
containing the Visio document, Visio creates a relative hyperlink and
the Address box contains the following:
..\MyDocument (above).docx
Tip:
“..\” is arcane syntax that predates Windows. It means “go up one directory level.”
When
the target document is located on any drive other than the one
containing the Visio document, for example, drive D or drive K or a
network share such as \\MyServer\Human Resources\FY2011\, Visio creates
an absolute link and the Address box contains something like the
following:
D:\SomeFolder\MyDocument.docx
or
\\MyServer\Human Resources\FY2011\MyDocument.docx
The following figure shows a target document on drive N.
Tip:
Although the link shown in the
previous graphic is an absolute link because the target object is
located on a network drive, the Use Relative Path For Hyperlink check
box still appears with a check mark. Just to confuse things further, if
you try to clear the check box, you will find that you can’t do so.
Warning:
Important
You can only create relative links to files that are located on the same physical hard drive as the saved Visio drawing.
Tip:
Visio
always creates an absolute link if you begin your address with a server
name, drive letter, or web protocol. All of the following will create
absolute links regardless of the location of the Visio drawing: