0

I am trying to do the following in excel: I want to have a hyperlink to a file (pdf, word, whatever) in a cell and whenever I click it, instead of opening the file, windows explorer to open the folder containing the file and select it (highlight it).

If what I described doesn't make much sense, you can see similar examples of what I am trying to achieve, by doing one of the following:

1) Open a pdf file with Adobe pdf reader. Right-click on a page of the document and select "Document Properties". In the window dialogue that comes up, if you click the filepath (see "location", in the advanced properties group), not only it opens the folder containing the file, but it also selects the file. or 2) Download something with Chrome. And in the downloads bar at the bottom of the window, once the file has finished downloading, right-click on it and select "show in folder".

Any help will be much appreciated.

Eventually, what I am trying to do is to create a spreadsheet that will have links to files in a folder where I keep all my e-books.

1 Answer 1

1

The /select parameter for explorer.exe will do the job as suggested here.

In VBA, it could be done like that:

Call Shell("explorer.exe /select," & FileFullPathName, vbNormalFocus)

where FileFullPathName is the path to your file, which may even contain spaces, p.e.

FileFullPathName="C:\New Folder\My Document.docx"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .