Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

hyperlink in MS Word independent of user

Aug 1, 2011 6:40PM PDT

Hi guys,

I created a hyperlink in a document in Microsoft Word 2007 and 2011 to open a specific folder in windows explorer.
Is there a way to make this hyperlink independent of the PC and user. I want to copy the document and folder to several other PC.
I am making this for backup reasons.

I already tried to set the hyperlink as
%userprofile%\My Documents\FolderName
this gave me the message "cannot open the specified file." in MS Word 2011.

Thanks for any help.
Regards

Discussion is locked

- Collapse -
Clarification Request
Folder name
Aug 1, 2011 7:07PM PDT

Are you trying to open a folder from within a Word document?

If so, I've never tried that, but I am not sure it will work.

If you have some .doc file in that folder, then that hyperlink may work, but not a folder.

Mark

- Collapse -
Re: Clarification request: Folder name - New!
Aug 1, 2011 8:00PM PDT

Yes I am trying to open a folder from within Word document, and this worked fine in case I used the following:
C:\Documents and Settings\Andreas\My Documents\MATLAB\Results

but what I want is to be independent of the 'C:\Documents and Settings\Andreas'

I thought that this might work
%userprofile%\My Documents\MATLAB\Results

but this failed and gave me that "cannot open the specified file."

thanks

- Collapse -
I never cease to be amazed in these forums
Aug 1, 2011 9:44PM PDT

I don't have Office on this Win 7 rig I am using so I booted up my XP system which has Office/Word 2002.

I've tried this. I created a hyperlink, (Insert > Hyperlink), into a document for;
file:///C:\Documents and Settngs\Mark Flaxman\Desktop

When I clicked it, (CTRL+Click), my Windows Explorer opened to my Desktop folder. I never knew it could do that! Happy

But, I also tried a %userprofile% link and the link I used was;
file:///C:\Documents and Settings\Mark Flaxman\%userprofile%\My Documents

However that failed with the same error message you see, but I think I see the problem. Hovering over the link, Word gives me the actual link it has added, and this is;

file:///C:\Documents and Settings\Mark Flaxman\%25userprofile25%\My Documents

Notice the 25's in the link as in %25userprofile25%?

I don't understand that. I would have had theories, but they fail. In case they might help you though, I state them below;

1] The % is a non-standard ASCII character for HTML hyperlinking, and is a special character which needs defining in the hyperlink. For example, adding a space in a hyperlink I would need & nbsp : (I have had to add my own spaces in-between the & nbsp ; ). For an & I would add & amp ;

But that theory fails because in the link above, the 25 is both before and after the % and that is not logical.

2] In any case, there are already spaces in "Mark Flaxman" and "My Documents" but I see no & nbsp ; for those.

So I am stumped. I've tried Google for USERPROFILE in Word 2007 Hyperlink. I can only see one link which appears to say it is "Solved", but this is for the ExpertsExchange forum and they no longer allow casual visitors to see the solutions. You have to sign up to see the solution. Here's the link anyway in case you want to sign up and see it;
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/Q_26816686.html

Hopefully others here will have a better idea.

Mark

- Collapse -
Re: I never cease to be amazed in these forums
Aug 1, 2011 11:56PM PDT

Thanks Mark for the help; hopefully somebody out there can still support with this issue.

- Collapse -
Clarification Request
You may want to try a RELATIVE link.
Aug 2, 2011 12:08AM PDT
- Collapse -
My problem solved
Aug 2, 2011 12:20AM PDT

Thanks Bob, that was very helpful for my case.
My document containing the hyperlinks is always in a fixed relative position to the target folders, so I just need to mention in the hyperlink the relative address

in my case as an example, the hyperlink should contain only the following:
MATLAB\Results

thanks a lot guys

- Collapse -
Nice
Aug 2, 2011 6:59AM PDT

I had thought of using relative links, but misunderstood the need to use %userprofile%.

Glad you got it sorted with Bobs guidance.

Mark