PDA

View Full Version : VBA code to convert xls to PDF



saurav.falia
09-10-2009, 06:46 AM
Hello Guys,

Can any one help me with the VBA code to convert xls to PDF?
I know that some distillers or Dll file needs to be used. Kindly also provide me the addin files, if not a problem. I am in great need.....please help.

Regards,
Saurav Falia

CreganTur
09-10-2009, 07:07 AM
Welcome to the forum- it's always good to have new members.

I don't have example code to provide, but I can say that the simplest way to do what you want would be to print your excel file to your pdf writer- this would automatically create a pdf version for you. There are a number of threads that deal with this subject, so check out the search function.

HTH:thumb

saurav.falia
09-11-2009, 12:57 AM
Thanks for the reply buddy!!! :)

amhiddema
09-20-2009, 11:22 PM
Apologies for doing anything wrong, these are my first words on this forum.
I ran into your problem and have been strugling with this also for quite a while.
This is how I solved the problem, with an AddIn PDFCreator in MSOffice 2007 which is freeware and following code.

Hope I have been helpful.

Dim b As String, p As String, vPDFPath As String

b = Range("C2")
p = Range("C3")

PDFPath = p & b

Range("A1", "A10").Select


Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
PDFPath & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False

saurav.falia
09-20-2009, 11:53 PM
Hello Buddy,

Thank you very much for your reply.......I am gratified.
I will be highly obliged if you can mail me the whole code and the addind to my personal mail (saurav.falia@gmail.com).

I hope to receive your reply soon. :)

Thanks a lot buddy,
Saurav.