I have created a hyperlink that connects to the files which exist in the same directory (or subdirectory) as the Excel file. How do I point to the file without setting the full path? The reason I don't want to give the full path is that if I moved the directory which contains other files and the Excel file to a different location, the hyperlinks shouldn't break.
I tried the option below, but the hyperlink only works if I don't move the files.
I want to assign the hyperlink an address like Example\IndexUsage_notes.txt instead of the full path D:\SCRIPTS\ADMIN_SCRIPTS\Example\IndexUsage_notes.txt
After searching online, I found this articles to be useful:
https://www.extendoffice.com/documents/excel/631-excel-file-location.html
This shows you how to get the file path of your workbook and how to isolate the main directory without using Macros.
Then you can insert your main file directory, sub-directory, and filename into the HYPERLINK function.
You can add text to the main directory using TEXT($B$1,0)&TEXT($B$2,0)&......
Dynamic Hyperlink Spreadsheet.png
Once the sub-directories are created and files are in place, you may not be able to move them easily without changing the sub-directory name manually within the spreadsheet or using Macros.
Related
I want to read the text from excel and find the corresponding folder in windows.
Let say, I have excel file containing the list of folder I want to open in file explorer.
and here is my folder.
So I want to read from excel file on cell A2, then after read “dotnet”, I want to find in the screen, where is “dotnet” folder. I have tried using function “text exist”. However, it wasnt working.
Can anybody tell me which function should I use to find the corresponding folder?
Use read range activity to read all data from excel. Once you have the directory, use for each item in data table, you can simply open run command with send hot key (win + r) and type into your directory.
That should open the folder up for you.
In an excel file I use CELL("filename") in order to get the path and filename of my excel file.
When I save the file at another location this formula doesn't work. Instead of displaying the path and filename it's written "missing".
When saving the file at another location I expect it to work. When entering the same formula agin it is updated. Since this is a template that shall be saved at different location it must work without doing this manually. Any ideas of how to solve this?
I created an excel file housed within a specific Dropbox folder that uses a macro to append a date and time stamp to certain tabs of the file and then saves it to that same folder.
On a PC, the path is something like
C:\Users\MyName\Dropbox\Daily History\
while on a MAC it is something like
Macintosh HD: Users: meadowbrook: Documents:
The only thing I can think of to make it dynamic is somehow using CELL("filename") and dynamically storing it as a variable. Is there a way to just save as to the directory the file is in without needing to specify the path in VBA?
Use
Application.ActiveWorkbook.Path
for just the path itself (without the workbook name) or
Application.ActiveWorkbook.FullName
for the path with the workbook name
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.
I have written a macro which opens 2 comma delimited files (Generic Tables used by Prophet 8.1 ending with a .fac extension), does a comparison and creates another workbook which highlights all the differences.
The macro seems to fail when the files have the same name but has different directories.
What would be the easiest way to overcome this problem without having to actually change the file name as seen in the location? It is against company policy to mess with the actual files as seen in the location. Is there a way to assign some temporary name to the file and not save it?
In Excel you cannot have two files open with the same name!
If you don't want to rename the files, copy one temporarily using a different name - and delete it afterwards (assuming you only want to read from it)
If you have to modify/save the original files, then the only two options you have is to rename them (you can afterwards rename them back to the original name) - or change your procedure so only one file is open at the time (e.g. by temporarily storing some data from the first file in a temp workbook that gets created and closed during the code execution).