Can a pdf be automatically printed from excel

April 17, 2011 at 00:52:11
Specs: Windows XP
Is there a way to have a pdf file attached to an excel worksheet so that when a reference number appears in a cell the pdf is automatically printed, or opened? Example: I have an Excel Spreadsheet, 'Lunch Production Schedule', with recipe name in C12:C54, and corresponding recipe number in the D12:D54. I have all recipes saved as pdf's. when the recipe number appears on the production schedule, i want the recipe card printed automatically, or opened so it can be printed. In case it matters, D12:D54 has fomula =VLOOKUP(C12,RecipeNumbers!B:C,2,FALSE). Any help is appreciated.

See More: Can a pdf be automatically printed from excel

Report •

#1
April 17, 2011 at 08:42:59
How are the Recipe PDF named and where are they located?

You can use the =HYPERLINK() function.

As a quick example:

Your Recipe PDF number is in cell A1
In Cell B1 enter the formula:

=HYPERLINK("C:\Complete\Path\to\PDF\Directory\"&A1&".pdf")

When you click on cell B1 your Recipe PDF should be displayed.

MIKE

http://www.skeptic.com/


Report •

#2
April 17, 2011 at 09:23:46
=HYPERLINK("C:\Documents and Settings\ric69943\Desktop\Main recipes\index\"&D13&".pdf")

There it is, in all it's glory... however, it returns a pop up that says Cannot open the specified file. I tried shortening the path by moving the directory to my desktop, but that didn't work.


Report •

#3
April 17, 2011 at 11:00:13
Not sure why your getting the error message.

You have a PDF reader (I use Adobe) of some type enabled and associated with PDF files?

What version of Excel are you using, I'm on 2007, but try checking your options set up.

What is the actual file name?

Upper or Lower case should not be any problem
and white space should be ok also as long as the name
is spelled out correctly.

MIKE

http://www.skeptic.com/


Report •

Related Solutions

#4
April 17, 2011 at 11:48:03
Mike,

IT WORKS!!!! After beating my head against the wall all day, I looked a little closer at the the whole formula, tracing it from one end to the other. What ended up being the problem is the vlookup I'm using returns the exact recipe number that is on the pdf, with a space in front of it so it looked like this , L 085 02, but the pdf is saved with the name L08502.pdf, with no spaces.... duh!!

Sooooooooooo, this leads me to my next question.....
Anyone know a short cut for changing a MASS amount of pdf filename?????...(pause)....'blink, blink'....(pause)...


Report •

#5
April 17, 2011 at 11:52:38
You could try wrapping the vlookup in a =TRIM() function.
or use it on the vlookup target cells.

The leading white space should not matter.
The embedded space, will probably cause an error.


MIKE

http://www.skeptic.com/


Report •

#6
April 17, 2011 at 12:03:39
Anyone know a short cut for changing a MASS amount of pdf filename?????...

If there is a disconnect between how the file names actually appears
and how you are storing them,
just change how you store them so the name in the cell matches what the actual file name is.

How are you storing the file name in the "RecipeNumbers" sheet?

MIKE

http://www.skeptic.com/


Report •

#7
April 17, 2011 at 12:24:01
Lets get this correct,

A leading white space in the file name does not matter,
because the operating system will not allow a leading white space in a file name.

A leading white space in the file name stored in an Excel file does matter
because Excel reads the white space as a legitimate character.

So your actual file name cannot have a leading space,
only the file name as stored in Excel can have a leading space.

Which can cause Excel to give an error message.

If your stored file name has a leading space,
then you will get an error message

If your actual file name has an embedded space,
then your stored filename must also have an embedded space.

MIKE

http://www.skeptic.com/


Report •

#8
April 17, 2011 at 12:29:20
Try this:

=HYPERLINK("C:\documents and settings\owner\my documents\"&SUBSTITUTE(A1,CHAR(32),"")&".pdf")

That should eliminate any space characters in your file name.

MIKE

http://www.skeptic.com/


Report •

#9
April 18, 2011 at 12:31:11
YEEEEEEEEEESSSSSSSSS!!!!! PERFECTION!!!! Do you offer online courses? As much as a appreciate your help, you really should be getting paid for what you do....

Report •

#10
April 18, 2011 at 12:42:30
Glad I could help.

MIKE

http://www.skeptic.com/


Report •

Ask Question