converting word to pdf file and specifying name based on a list

Hi Experts,

I have a large number of files in word that I want to convert to pdf file and give the specific names.  I have the names in an excel spreadsheet, the old name of the word document, the name of the new pdf file to be created and the path of the word document (same path as the pdf file.  All files are in the same location.

I have  the pdf drivers so I can print to pdf files.  Is there an easy way to do this in vb?

Thanks in advance for your help.

Bill

Spead sheet format:

Word file                PDF file                   path
document1.doc       michael1.pdf           c:\test\
document2.doc       juhn.pdf                 c:\test\
LVL 2
bilalahaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

edokanCommented:
as far as i remember, word'a object model has a method to do this.

Application.PrintOut has some parameters that allow you to direct printer commands to a file and the name of the file. Please try it.

Sub ConvertToPDF( s_doc As String, s_pdf As String )
  Application.PrintOut , , , s_pdf, , , , 1, , , True, , s_doc
End Sub

ConvertToPDF( "c:\test.doc", "c:\test.pdf" )


PS: do not forget to set the printer to PDF printer
PS: i tried this office image printer, it works but also it lanuches the document image viewer.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bilalahaAuthor Commented:
Well edokan,

I did it in two steps, selected all the files at one and printed to pdf file, they were printed with the same name as the original, then I meged the cells in the spreadsheet and created a batch file:
rename XXXX1.doc michael1.pdf
.....

It took about 1 hour to create the PDF files and about 10 minutes to rename them.

This is similar what you have up there your example.

Thanks for the help.

Bill
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.