Advanced Hyperlink in Excel - Hyperlink to EXE specifying file to open

Posted on 2012-09-14
Medium Priority
Last Modified: 2012-09-14
In Windows you can create a shortcut to the Internet Explorer executable and then after the path add a web address you'd like the browser to open to.  For example, the shortcut path would look like:

"C:\Program Files (x86)\Internet Explorer\iexplore.exe" http://www.google.com/

I'd like to do something similar in Excel with a hyperlink in a cell.  I have a portable version of VLCPlayer in the root of my flash drive and an Excel document further in the drive.  I'd like to point to the EXE of the portable VLC and then specify a path to a video file it should open.  In the desktop shortcut example above, my shortcut would look something like:

"..\..\..\VLCPortable\VLCPortable.exe"  ..\..\videos\file.mp4

Does anyone know if this is possible or of another way to accomplish this?  I can't depend on the user having VLC player installed, so I need to point to the portable EXE included on the flash drive.
Question by:psueoc
  • 2
  • 2
LVL 26

Accepted Solution

redmondb earned 2000 total points
ID: 38399088
Hi, psueoc.

Not an ideal solution (you'll get security warnings), but have you considered using a batch file?

The batch file might look something like this...
@Echo off
"D:\VLCPortable\VLCPortable.exe"  "D:\videos\file.mp4"

A hyperlink formula could be...


Author Comment

ID: 38399268
Assuming I can make the links/paths relative instead of static, this might actually work.  I'll give it a quick try and let you know the results.  Thanks.

Author Comment

ID: 38399363

Your idea was 99% of what I needed.  The batch worked on its own with relative paths but when i linked to it in Excel it wasn't working.  I changed the Echo to On and added a Pause at the end to inspect things.  Turns out the relative paths were pointing to different locations when the batch was run from Excel.  I did a quick google search and discovered I needed to add a %~dp0 to the beginning of the paths.  The %~dp0 points to the batch file's path...from there the relative links know where to go.

So, for example...

Prior to adding the %~dp0 the batch file was:
"..\..\..\VLCPortable\VLCPortable.exe" "..\..\videos\file.mp4"

All I needed to add was a %~dp0 to the paths:
"%~dp0..\..\..\VLCPortable\VLCPortable.exe" "%~dp0..\..\videos\file.mp4"

Thanks for the great idea.  I really appreciate your help.
LVL 26

Expert Comment

ID: 38399569
Thanks, psueoc.

(My absolute paths were only only an example. The correct absolute paths should work fine.)

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New style of hardware planning for Microsoft Exchange server.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question