Bookmark Special Paste, Excel look in same folder - excel

I have a word doc and an excel doc, I have created bookmarks in word and special pasted into excel.....These bookmarks works AS LONG as the files stay in the ORIGINAL location (example- C:\Documents and Settings\My Documents\New Form)
BUT
I need to move the documents to different client locations (example- C:\Documents and Settings\My Documents\client1)
In excel the cell information reads like this;
=Word.Document.8|'C:\Documents and Settings\My Documents\NewForm\TestFactFind.doc'!'!Title'
Is there anything I can put so the excel file will look into its current folder to find the word document instead of a set location?

NON VBA Method
Yes it is possible for the Excel formula to pick up the value from a file from the same directory where the formula containing files reside. You have to use INDIRECT(). However a word of caution. INDIRECT will work only if the destination workbook is open.
Here is an example
Let's say the formula in Cell B1 in C:\Book1.xlsx is
='C:\Sample\[Sample.xls]Sheet1'!$A$1
Then put this formula in Cell C1 for testing it
=INDIRECT("'" & LEFT(CELL("filename",A1),FIND("[",CELL("filename",$A$1))-1)&"[Sample.xls]Sheet1'!$A$1")
Screenshot

I dont know about Word bookmarks, but I assume they are the same as Excel hyperlinks (?)
This may or may not be relevant in Word, but in excel you can create a link to any other document using the hyperlink formula. If you use the current directory (folder) as the root, it will go from there.
".\" is the current folder
"..\" is the parent folder that the current folder is in
So lets say you have an excel sheet with links to 20 Word documents stored in a subfolder called REPORTS (excel to word being the reverse of what you proposed, but it is probably the same the other way around?).
The links in each excel cell would be:
=HYPERLINK(".\REPORTS\JAN.DOC","January report")
=HYPERLINK(".\REPORTS\FEB.DOC","February report")
=HYPERLINK(".\REPORTS\MAR.DOC","March report")
etc...
A feature I use often is to have the filenames, or part of the filenames, listed in an excel column parellel to the links, and use that cell in the hyperlink filename. Take the following example, and assume it to be range A1:B4 (Line 1 being the column headers "month number" and "link to report").
In this example, I named my word documents MONTHxx.DOC, xx being the month number.
MONTH NUMBER LINK TO REPORT
01 =HYPERLINK(".\REPORTS\MONTH" & A2 & ".DOC","Report for month " & A2)
02 =HYPERLINK(".\REPORTS\MONTH" & A3 & ".DOC","Report for month " & A3)
03 =HYPERLINK(".\REPORTS\MONTH" & A4 & ".DOC","Report for month " & A4)
etc
Having the cell at the end in the second part of the hyperlink puts the month number also in the name of the link for the user to see. You can, of course, use any cell there to put a name.
The beauty of this method is that if you have, say, a list of 500 files to link to, and they are all numbered in sequence (like the example), you can just copy-paste the first hyperlink all the way down the column which will instantly give you 500 links to other documents.
Just FYI, the documents do not need to be open already. Clicking the link will open the linked document.
I know this is not what you asked about, but it is fairly close. Hope it helped.

Related

Excel, use file path to reference cell values in another workbook

I have a series of daily spreadsheets which are file by:
year / month / date
e.g.
/Users/myles/Dropbox (Green)/05_GM Vessels/Crew Dropbox/Green Isle/02_Daily Logs/2019 Logs/[GI_Daily_Log_30.07.2019.xlsx]Sheet1'!$B$44
I would like to use a formula to extract the value within the specified cell (B44 in this case) and show it in a master / summary spreadsheet.
The files are in a different directory to the master / summary spreadsheet.
I have a formula which generates the above file path based on values in other cells. E.G. ="["&$D$14&$W5&"/"&$A5&"]Sheet1'!$C$24"
Which creates the following text within a cell;
[/Users/mylesmetson/Dropbox (Green Marine)/05_GM Vessels/Crew Dropbox/Green Isle/02_Daily Logs/2019 Logs/7_July/[GI_Daily_Log_29.07.2019.xlsm]Sheet1'!$C$24
Ideally I would like to remove the first / and then insert " =' " which if pasted as text into a cell, would then extract the value from this spreadsheet file and the referenced cell. But this does not work. instead I am having to do this manually in notepad and then copy & paste the entire text back into the cell.
Finally prior to excel retrieving the number in the referenced cell, I have to give permission / find the file location.
This is quite a complicated thing to explain and I have not found any other solutions on the internet which are 100% relevant to this scenario. I think a macro may be required, but hopefully this can be done elsewise.
The indirect macro, would be ideal, apart from it requires the spreadsheets to be open, which is simply not practical either.
Thanks
for any help which can be provided.
Myles

EXCEL maintain hyperlink with the cell content after sorting/ using formula

INTRODUCTION
I have made a excel sheet of file index. Each file entry is linked with scanned copy of the file. So when i click the file name in excel sheet the linked PDF file opens.
ACTIVITY
In a separate worksheet i have made a search function based on multiple search results with partial matching. So when i enter part of either file name or subject i get the file name using
" =IF($F$1="","",IFERROR(INDEX(A$2:A$8,SMALL(IF(ISNUMBER(SEARCH($F$1,B$2:B$8)),ROW(B$2:B$8)-ROW(B$2)+1),ROWS(B$2:B2))),""))
"
PROBLEM
The file name obtained is plain text without the hyperlink associated with the file name in the master database.
WHAT HAS BEEN TRIED
I have tried using
(A) =IFERROR(HYPERLINK(.....))
(B) =HYPERLINK(CELL NUMBER)(By getting the row number from formula and using index function to reference the cell)
There is a tiny trick:
Insure the hyperlinks in the source column are formatted so that the "display name" is the URL. You can use either Inserted hyperlinks or the =HYPERLINK() worksheet function.
Say we have links in column A and we want an alphbetized list in column C. In B1 enter:
=LOOKUP(1,0/FREQUENCY(ROWS($1:1),COUNTIF($A$1:$A$3,"<="&$A$1:$A$3)),$A$1:$A$3)
and copy downward. (Column B is in alphabetic order, but the links are "cold") Then in C1 enter:
=HYPERLINK(B1,B1)
Even though the links in column B are "cold", the links in column C are "hot"

How to hyperlink all pdf files present in a subfolder to excel?

I am trying to hyperlink all the fields in column B (picture given below) to the respective content in the folder (picture also provided).
I realized its stupid for me to do it manually and it takes a very long time to do so.
Is there a better way to link them automatically or with more ease?.
I realize that I can do it with help of VBA but I have no clue how to do it.
This is how my excel column B looks before hyperlinking:
So this is what I get after manually adding the hyperlinks to
column B.
This is the folder(folder name is 2016) which has subfolders (the one in image) and in each of these
subfolders there is a pdf file and a word file.
I am required to hyperlink the contents in column b (which are not already hyperlinked to the pdf files to their respective subfolders in this folder "2016" (You can see the address bar).
Here are the pdf and word files inside the subfolders of "2016".
So basically you see is that in column B the numbers in the end are in series. I want them hyperlinked to the pdf files inside these subfolders.
If you observe closely , the subfolder have a huge name (including the parenthesis content) , whereas my column B has name of the sub folder excluding the parenthesis part.
So basically its like matching the serial numbers and hyperlinking the pdf file inside the subfolders.
EDIT:
I tried the following by using =HYPERLINK("\\qatargas.com.qa\doc\Admin\Al_Khor_Community\Alwaha_Club_Admin_Office\Comments & Suggestion Response\2017\"&B1512&" ("&C1512&" "&D1512&")\"&B1512&" ("&C1512&E1510" "&D1512&")"&".pdf";B1512) on cell e1512.
I get this error
Insert a new column "C" (or wherever) and enter in (for example) cell C1210:
=HYPERLINK("file://C:\your_base_path\" & B1210 & "\name_of_pdf_file.pdf","Click to view PDF")
For example in the row 1512: you want to have a hyperlink to a pdf (what is the concrete name of this pdf?) in a path "[...]\qatargas.com.qa\doc\Admin[...]\2016\AKC-CS-17-0124 (QG 3739)". Right?
Then write in cell e1512 the following formula (if the name of pdf is always the same):
=HYPERLINK("[...]\qatargas.com.qa\doc\Admin\[...]\2016\"&B1512&" ("&C1512&" "&D1512&")\"&"<nameofyourpdf>";B1512)
You have to use your path (i used [...] to drop part of the path) and you have to use the name of your pdf, which is always the same you said.
or if name of the pdf is like the Name of the folder:
=HYPERLINK("[...]\qatargas.com.qa\doc\Admin\[...]\2016\"&B1512&" ("&C1512&" "&D1512&")\"&B1512&" ("&C1512&" "&D1512&")"&".pdf";B1512)

Paste excel link formula using vba

I am working in an organization where we have 100s of excel files on our shared drive. These excel files contain asset numbers to our company assets in different cells within the files. What I would like to do is create a script in vba which would run only once and search through all these excel files using the find method and paste their cell addresses adjacent to their file path (I already have the paths of all the files in an excel sheet). But this address should in the form of a link formula, just like "=A2" so that we can later on modify this formula if there is a change in the position of the asset number without using vba. So suppose,
If cell E3 in the file1 contains asset number "XXX0000", the vba script should paste something like " ='\shared drive\folder path\file1.xlsx]WS'!$E$3 " in the cell next to the path,"\shared drive\folder\". So later on we can manually modify this formula if there is a change in its cell location
Thanks

Getting Reference (url link) from another cell?

I want to link a cell to an external file. The name of the external file changes daily though.
I created a cell that contains the full address of the external file (C:\Users\Main\Desktop\data\History\02092013.csv)
I then named that cell HistoryFileReference
So then why does this not work?
='HistoryFileReference'!$A$2
When I press enter, a window named "Update Values: HistoryFileReference" pops up, asking me to choose a file.
edit: I don't want to "update links" via excel. Thanks
For this to work you will have to manually put brackets in the file name and then store it as
C:\Users\Main\Desktop\data\History\[02092013.csv] in the cell which you have named as HistoryFileReference
Now open the CSV file and leave it open. Go back to the above sheet and type this formula
=INDIRECT("'" & HistoryFileReference & "02092013'!$A$2")
and press Enter and you are done :)
Caution: Next time you open the file, do not click on Update Links else all the values generated by the above formula will change into #REF! as Indirect doesn't work with close files.
For the sake of an example, I have place a csv file in C:\ as shown in the screenshot below and I am trying to retrieve values from Cell A1

Resources