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:

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Nemon

New Member
Joined
Mar 24, 2011
Messages
2
I joined to ask the very same question. I did a search but didn't find any similar issues.
 

Nemon

New Member
Joined
Mar 24, 2011
Messages
2
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.
 

Blueridge227

New Member
Joined
Mar 23, 2011
Messages
29
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,507
Messages
5,523,310
Members
409,511
Latest member
hitesh222002

This Week's Hot Topics

Top