A Button to open specified file?

bnapy

New Member
Joined
Aug 2, 2011
Messages
4
I'm a longtime Lurker first time poster, I've gotten alot of information from this site and want to thank all the contributors. I need a solution to a small problem I have.

I have a reconciliation worksheet that I've created, and I'm in the process of scanning the corresponding Invoices to my computer. I'm wondering if it's possible to make a button on the worksheet that would open the corresponding invoice (PDF FILE) given a specific value of a Cell.

For instance all the scans are labeled in numeric order. These labels will be on the corresponding expense row on the spreadsheet. I'd like a Cell that says "Enter Label here" which will reference the scanned invoice and a button you push that will launch the referenced PDF file.

Any help would be much apprieciated...
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You could do it with just a formula.

If you enter the Invoice number in say cell B2, put this in cell C2

=IF(B2="","",HYPERLINK("C:\Temp\" &B2&".pdf"))

This will create a clickable hyperlink in cell C2. Change the file path in the formula to suit.
 
Upvote 0
Thats an awesome ideal, I can't believe i didn't think of that. No wonder i couldn't google an answer to something so simple...Thank you.

Now I'm wondering how to make the hyperlink so that it will always look for the requested file in the same directory as the spreadsheet is located. The spreadsheet will be copied to multiple flash drives and depending on the system. The drive may be labeled D:, F:, etc...I'm wondering if excel corrects for this?
 
Upvote 0
You could have the user type in a drive letter in say cell A2

Code:
=IF(A2="","Missing drive letter", IF(B2="", "Enter Invoice number", HYPERLINK(A2&":\Temp\"&B2&".pdf")))

Better yet, have a Data Validation drop-down list for the drive letters.
 
Upvote 0
Thanks for the quick response. I'm looking into the Data Validation option now. If that doesn't pan out I'm going to use your "two cell" suggestion.

Again Thank You! It is much apprieciated!
 
Upvote 0
Everything worked perfectly, again thank you for your help. I've been google'n my last problem and think I have found a solution regarding the ability to open a pdf to a specific page.

I found some code that creates a function called GoToPDF so that was the last bit I had to get help on.

Alpha I really apprieciate your help!
 
Upvote 0

Forum statistics

Threads
1,224,508
Messages
6,179,189
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top