Link to home
Create AccountLog in
Avatar of lhutton

asked on

Hyperlink in Excel 2007 to open a file in a program using command line switches

I have the following (working) shortcut:

"C:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\mplayerc.exe" "D:\Presentations\20101201.wmv" /start 120000

I want to convert it for use in a spreadsheet; however, the closest I can get is "Cannot open the specified file." Here's what I have:

=HYPERLINK("C:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\mplayerc.exe ""D:\Presentations\20101201.wmv"" /start 120000")

How can I make this work?
Avatar of emilgas
Flag of United States of America image

Do you get the blue underline inside the Cell? and is it clickable?
Avatar of lhutton


Yes; when I click, I get an Excel Security Notice (which I click past) and then "Cannot open the specified file."
Oh, then try disabling the warning prompt. I think that should do it
Avatar of lhutton


I have both those settings enabled already, but I don't think Data Connections and Workbook Links pertain to my problem. Anyhow, I'm able to click past the Security Notice; the problem is what happens next.
Hyperlink function takes two parameters. =HYPERLINK(Parameter1,"Parameter2")
Parameter one is the Path to the File, and Parameter2 is a text label that Discribes the link. I don't think you have that correctly. and they have to be semerated by a comma.
Avatar of lhutton


I think the second parameter (Friendly_name) is optional; I tried adding it, separated by a comma, and it made no difference.
you could try

=HYPERLINK("C:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\mplayerc.exe 'D:\Presentations\20101201.wmv' /start 120000")

or try to use the space-less version of the path descriptors (something like progra~1\k-lite~1\mediap~1\)

If all fails (as it is likely to do, because i strongly suspect that the hyperlink function has not been intended to be used in this way), i suggest you insert a hyperlink to a batch file that performs the opening of the presentation, or use a vba macro.
Funny thing is I have the same setup at my work and it works. Initially I thought it would be a security issue with Office 2007, but I just checked it on a machine that has Excel 2007 and it worked. The only difference is I'm opening PDF files and he is trying to open wmv file. Another difference is that he is specifying what application should open the file whereas me, I just give the path to the File and Adobe Opens it automatically since PDF is associated with Adobe Acrobat
That particular difference is the essence of the problem :

opening a pdf file or a wmv file for that matter poses no problem.

=hyperlink("d:\presentations\20101201.wmv") , or

will form a hyperlink that opens the indicated movie (in its standard assigned player) or media player.

The author's problem as i see it lies in the difficulties involved in using hyperlinks with inline command line options.

Avatar of lhutton


I didn't have any luck with your suggestions, akoster. Do you think it would be possible to achieve with a vba macro, and what would be involved? (As there will be multiple files and time codes, I don't think a batch file will be appropriate).
Avatar of Arno Koster
Arno Koster
Flag of Netherlands image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account