VBA, Hyperlink to PDFs Question

Blueridge227

New Member
Joined
Mar 23, 2011
Messages
29
My situation is as follows:

I have a spreadsheet with column A consisting of a bunch of 4 digit numbers(1028, 1056 etc..) The 4 digit numbers are the same as the filenames of several PDFs in a folder on my local drive(C:\Test\).

I'm looking for a VBA that will search through the PDFs in the folder (based on the 4 digit numbers from column A) and place a Hyperlink to the file in Column B

If no match is found, then I need the cell in column B to remain blank(no hyperlink)

Any help would be greatly appreciated!
cheers
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I joined to ask the very same question. I did a search but didn't find any similar issues.
 
Upvote 0
My situation is as follows:

I have a spreadsheet with column A consisting of a bunch of 4 digit numbers(1028, 1056 etc..) The 4 digit numbers are the same as the filenames of several PDFs in a folder on my local drive(C:\Test\).

I'm looking for a VBA that will search through the PDFs in the folder (based on the 4 digit numbers from column A) and place a Hyperlink to the file in Column B

If no match is found, then I need the cell in column B to remain blank(no hyperlink)

Any help would be greatly appreciated!
cheers

Hi, I "borrowed" your thread as you can see, been looking for an answer to this. I found this solution today however, maybe it will work for you? I'm on excel 2010 btw...

Enter this formula in B1:
=IF(A1=0;" ";HYPERLINK("C:\Test\"&A1&".pdf";"Link"))

It should leave the B1 blank when A1 is blank, and a "Link" when A1 has a value entered like one of your pdf's.

Sorry for double posting, couldn't see an edit option. But hopefully this is a solution to your problem.
 
Upvote 0
Thanks for your reply. Unfortunately I can't use your suggestion. There will always be a value(filename) in the cell. What I was hoping for is when I place the pdf in the folder, excel would automatically place a hyperlink to the file with the same filename.


This is what i'm using in the meantime.
=HYPERLINK("X:\PT RECORDS\"&A:A&"\"&E:E&".pdf",E:E)

Column A has the folder name
Column E is the filename.

This creates a hyperlink to everything and gives a "Cannot Open File" messege if the file doesn't exist.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,181
Members
448,871
Latest member
hengshankouniuniu

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