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

Posted on 2012-09-14
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"

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
    LVL 26

    Accepted Solution

    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

    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


    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

    Thanks, psueoc.

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

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Suggested Solutions

    User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
    No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
    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.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now