I am working on an Excel-document to make a (project-)folder structure manageable, using HYPERLINKs to important files and folders (Word/Excel, etc.).

Since we are also using TFS, I want to add the possibility to check out and check in right from within the Excel sheet. The one-stop landing and overview page.

If I simply have

=HYPERLINK("C:\work\TF.exe";"simple test")

I get a security warning, but the program executes.

In the end, I want something like

=HYPERLINK("C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\TF.exe status $/MyProject/Documents /recursive";"Find local Check Outs in Document folder")

However, this does not work for spaces in the file path and also for the command line arguments. Is there any way to make this run without using VB? Even if I wrap parts of the hyperlink with quotes (using double double quotes for Excel: "" -> ") does not improve anything, I get "file not found" error.

And.. only only only if I have to use VB (I do not like the security warning), what would be the best way to do this?


An alternative is to create a shortcut with the relevant command line switches embedded in it. Then you can hyperlink to the shortcut. Note that the shortcut has a .lnk extension.

If you'd like to do something more involved than launching a single executable with switches, you could link to a batch script (.bat).

  • 4
    Or do the same with a batch file (.bat), which should be more versatile than a shortcut.
    – Bob
    Oct 25 '12 at 15:55
  • It does not allow me to use parameters (e. g. a cell with the path), still, it is working fine, just a little overhead right now, and I might go for the VB solution later. Many thanks! Oct 26 '12 at 15:39

As far as I know, it is not possible to use HYPERLINK like that - except with the nice trick of anthony.

However, spaces in the hyperlink don't matter as long as the path is in quotes.

To solve this you might have to use VBA, if the command-line parameters have to be dynamic or if you don't want to use anthonys approch for other reasons.

This would be a neat fast way:

Shell "C:\Program Files (x86)\Notepad++\notepad++.exe -notabbar", vbMaximizedFocus

or to use your code:

public sub demo()
  Shell "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\TF.exe status $/MyProject/Documents /recursive"
end sub

By the way - usually there is, and should be, a warning, when executing files through hyperlinks. So if you wan't to use HYPERLINK because of "don't like warnings", you got them there too ;)

On the other hand - the VBA solution can avoid warnings, if you sign your Workbook with a trusted signature or use it in a folder, wich is setup as trusted for macros.

  • Thanks, I might go to this eventually in order to only have the path in one cell, and then have the other cells simply refer this and call different files with parameters. Oct 26 '12 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.