Avatar of hypercube
hypercube
Flag for United States of America asked on

Excel hyperlinks getting corrupted.

I have a large number of Excel files in one folder e.g. C:\Users\Me\Documents\Files\[*.xlsm]
One of the files is a summary of all the other files.  It's just a list of all the other files with certain cells summarized.  Let's call it list.xlsm.
In the first column are descriptive names of each file.
I have elected to add a hyperlink to these names that points to that file so I can open it easily.

Twice now, I've found the hyperlinks corrupted like this:

Original hyperlink:
file.xlsm

So, since list.xlsm is in the same folder, the implication of this link would be C:\Users\Me\Documents\Files\file.xlsm

This morning I opened the list.xlsm file and tried to use the hyperlinks.  They didn't work.
In opening the links for editing, I find them changed to this:

Resulting hyperlink:
../../../../../AppData/Roaming/Microsoft/Excel/file.xlsm

that's right -../../ and so forth and the following reference to AppData, etc. exactly.

This is the second time that this has happened.  I need to prevent this as I only know how to fix it with a tedious manual process.
SpreadsheetsMicrosoft Excel

Avatar of undefined
Last Comment
hypercube

8/22/2022 - Mon
Joe Howard

When creating the hyperlinks don't use the full path, use the relative path. To add a relative path add .. before the file name.
To prevent it in the future goto
File > Options > Advanced > General > Web Options > Files and uncheck "update Links on save".
hypercube

ASKER
I have a routine that will find a string and replace it .. in the hyperlinks.
But I'm wondering how to do that where I want to add a ".." string to the beginning.
Ah well, putting the ".." in front of the link makes it unusable.  So that's out it seems.
Also, I have lots of linked data in the same sheet that I *do* want to have the data updated.  Is there a conflict?
ASKER CERTIFIED SOLUTION
Joe Howard

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
hypercube

ASKER
=HYPERLINK("C:\Users\Me\Documents\Files\test.xlsm","TextToShow")

That's a clever idea!
The disadvantage, which is undesirable but not unusual, is that it won't survive the files being moved to another folder or the folder name being changed.  
The advantage is that it can be Replaced much easier than running a script to change the hyperlink as it's in more "visible" code.

I wonder what would happen if you did this:
=HYPERLINK("test.xlsm","TextToShow")
?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23