Excel - Referencing external workbooks with relative file paths - excel

I have two workbooks in the same folder. I reference a cell from one workbook to another eg
='[WorkbookB.xlsx]Sheet1'!$A$1
When I save and close the two files, once I reopen them the formula has changed to a hardcoded path eg
='C:\Users\Me\Documents\[WorkbookB.xlsx]Sheet1'!$A$1
Then if I move the two files to another folder, the link breaks. Is there a way to keep the file paths relative, so as long as the two workbooks are in the same folder then it will still work? I've searched around and can't even work out if this is the expected behaviour as I've found people with the exact opposite problem, but this is how it's played out for me and I haven't found a solution. Any help would be appreciated.

Nevermind figured it out. The default behaviour is for the links to be relative, as I wanted. They weren't working because I moved both the files on to the desktop to test them out. Turns out they need to be in a folder otherwise excel can't find them.

Related

Broken external links in Excel : a leading "file:///" scheme prepended to paths can't be evaluated in formulas

I have been using Excel for a long time and pushed it to its limits, but this one is new, probably because of a recent update, so I am not sure anyone will encounter the issue I am raising up here.
I have several crossed referenced workbooks in formulas, these workbooks being saved in the same folder so the external links are relative in this folder (and supposedly unaffected by this folder being renamed...).
I recently noticed that cells using some of these referenced workooks in their formulas could not be evaluated anymore and returned an error as if the workbooks have been moved. In the formulas, the path of these referenced workbooks which should start with C:\... now starts with file:///C:\....
If I open the Edit Links window, I can manually update the target workbooks (selecting the same workbooks) and the formulas work again.
If I replace the file:/// text by an empty string to remove them, they also work again.
Using this code in the VBE's Immediate window also reveals broken links:
?ActiveWorkbook.Name: ?"EXTERNAL LINKS: ": For Each l in ActiveWorkbook.LinkSources(XlLinkType.xlLinkTypeExcelLinks): ?" "&l: Next
returns C:\File1.xlsx or file:///C:\File2.xlsx
If I save the workbooks after that and reopen them, the links are broken again.
What is causing this?
By inspecting the content of an unzipped workbook, and more particularly the externalLink_.xml.rels files, I noticed the external links was not relative at all, the broken links looked like this:
Target="file:///\\123ABCD\FILENAME.XLSM"
So it seems that Excel uses a shorten path (like MS-DOS/Windows 8.3 filenames), but later it "forgets" to remove the prepended "file:///" string when "resolving" the shortcut in the path.
How to fix
Save and close the workbooks if not already done, shorten the path (rename a folder with a name too long for instance), reopen the workbooks, update the broken links, save, and voilĂ !
PS: some concepts are between quotes, feel free to correct me...

Large linked .xlsb workbooks

It now seems necessary to take my 50MB workbook and split it into 3 separate workbooks. Ultimately, when this program is moved to different computers, these 3 files will need to be moved together in order to function (of course). Is there a way for all of the links and conditional formatting to remain absolute? That is, all the files will be in the same folder, so a path would not be needed or wanted, just the workbook name and the sheet/cell reference.
If this is not possible or practical, am I missing something? Is there another way to do what I want to do, which is allow a very large spreadsheet to run on less powerful machines?
As long as the files are in the same relative locations, the links should update automatically. As far as I know, for the files in the same folder, it's not an issue at all. The same with going down the folder path. Problems might start when going the other way, so I'd keep them in the same folder.
Conditional formatting might be an issue though, but you could try linking just the conditions to the workbook you're trying to format.
To speed up the spreadsheet you can try manual calculations. I don't know how your spreadsheet looks like or how slow are the machines you're talking about, but that helps in most cases
P.S. Sorry for an answer when it should really be a comment, but I don't have enough reputation yet to do so

Find Missing External Links in Excel

My spreadsheet has external links that I cannot find. It pops up the "workbook contains links to other data sources" warning upon opening. I don't want to just suppress the link warning, I need to remove the links.
I've tried all the basic ways to find external links that I'm aware of, and it's still happening. I've tried:
Searching for "[" in formulas in the entire workbook
Charts
Checking the named ranges from the Formulas/Name Manager menu
Checking objects
Conditional formatting menus
Is there another way to find external links? Thanks.
It can come from several sources. In my case, it came from the formula of a rule in the conditionnnal formatting. And no Excel search tool could find it.
In the case of an xlsx file, you can find it with an automatical approach:
In the Data tab, click on Edit links. All your links should be displayed. Mark down the values of the Location fields.
Unzip the xlsx file. Technically, an xlsx file is a zip container. See this post for more information.
Now search the whole directory for the Location strings.
Figure out to what your links are related. In my case, it was inside a x14:conditionalFormatting xml node. No wonder the Search tool did not work, it was not in a cell.
Modify that formula
Game over.
I would check the names collection in your workbook.
If you have a named range, for example, that has links to another workbook this will do this also... You can examine these in Excels Name Manager, or some VBA code executed in the debug window...like:
for i = 1 to names.Count: debug.Print Names(i): Next
I had an Excel 2013 file that whenever opened displayed a message regarding a missing external link. I could not find such a link (and location in file) using many suggestions and tools (Kutools, FormulaDEsk etc.).
Finally, I changed the file from xlsx to zip, opned and searched and deleted the gokder relating ton External Links (and changed back). Problem solved!

Excel: moving files that contain relative file references

When a formula in Excel refers to a cell in another file, Excel stores a relative pathname so that if you move the files the links don't break. This works as I expect when the files are stored on a network drive, but not when the files are stored in a SharePoint doc library. Any ideas why and how I can fix it?
In more detail ...
Setup 1 (works perfectly)
\\server\UserFiles$\MClarke\My Documents\Folder1\a.xlsx includes the formula ='\\server\UserFiles$\MClarke\My Documents\Folder1\[b.xlsx]Sheet1'!$A$1
Move both files from Folder1 to Folder2
Open \\server\UserFiles$\MClarke\My Documents\Folder2\a.xlsx and the formula automatically changes to ='\\server\UserFiles$\MClarke\My Documents\Folder2\[b.xlsx]Sheet1'!$A$1
Setup 2 (fails)
http://intranet-server/dept/Folder1/a.xlsx includes the formula ='http://intranet-server/dept/Folder1/[b.xlsx]Sheet1'!$A$1
Move both files from Folder1 to Folder2
Open http://intranet-server/dept/Folder2/a.xlsx and the formula (incorrectly) still says ='http://intranet-server/dept/Folder1/[b.xlsx]Sheet1'!$A$1
I have tried moving and opening files in Setup 2 with both a mapped network drive and using SharePoint's "Open with Explorer" function. Both approaches give the same undesired behaviour: the formula in the moved file continues to point to the original location of the file rather than the new location. So why would Excel store an absolute path in that case but a relative path in Setup 1?
I tried many alternatives and eventually found that the only way to update the file references was to do so manually using the Edit Links dialog from the Data ribbon. That works perfectly, but is just a bit annoying.

Opening Insert Hyperlink in Excel 2010 in a Specific Folder

We're having a problem with the Insert Hyperlink problem taking forever to populate because of a ton of files in a network folder (Windows 7, xp was fine... oh the good old days. And yes, I've tried everything, disabling search, different reg entries, etc... and I'd like a different and less hacky solution.)
What I'm looking for is a macro that prompts for a number (in this case a client file number), and then opens the Insert Hyperlink dialogue inside a specific folder (for example, the file number the user enters might be 4321, and then the insert hyperlink dialogue would be opened inside the folder z:\clients\4321\ It's the z:\clients folder that has a stupid number of folders in it)
The actual file that would be hyperlinked would be somewhere inside there, so additional browsing would have to be done by the user. And I'm not sure exactly how the macro would behave in so far as knowing what to hyperlink (presumably the current cell would make sense to me).
Thanks for any help you can provide!
... You may have to play around with it a bit, but your best bet is probably to set the Hyperlink Base for each user's sheet and then set relative hyperlinks in the sheet itself.
Hope this helps...

Resources