batch conversion to PDF of many hundreds of .docs?

B

Bob W

What's a good way to batch-convert upwards of 1,000 or more word.docs to PDF
without having to babysit the computer? We've got at least 1,000 word.docs
in multiple folders that we need to batch convert to PDF....ideally
overnight,while we are home asleep :)
 
G

Graham Mayor

Do you have a PDF converter that does not require human intervention, such
as Acrobat? If so you can batch print the contents of a folder to the PDF
driver. eg something like

Sub PrintFolderContentsToPDF()
On Error GoTo err_FolderContents
Dim FirstLoop As Boolean
Dim DocList As String
Dim DocDir As String
Dim sPrinter As String

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
DocDir = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

sPrinter = ActivePrinter
ActivePrinter = "Adobe PDF"
Application.ScreenUpdating = False

FirstLoop = True

If Left(DocDir, 1) = Chr(34) Then
DocDir = Mid(DocDir, 2, Len(DocDir) - 2)
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList <> ""
Documents.Open DocList
ActiveDocument.PrintOut
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
DocList = Dir$()
FirstLoop = False
Loop
Application.ScreenUpdating = True
ActivePrinter = sPrinter
Exit Sub
err_FolderContents:
MsgBox Err.Description
Exit Sub
End Sub

or you could simply select the files in Windows Explorer and print them to
the Adobe driver.

If you don't have a PDF creation tool that does not require human
intervention - such as most of the free ones - then you will have to employ
someone to intervene when required. It might be cheaper to buy Acrobat ;)


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bob W

Thanks G; will give this a go.

Graham Mayor said:
Do you have a PDF converter that does not require human intervention, such
as Acrobat? If so you can batch print the contents of a folder to the PDF
driver. eg something like

Sub PrintFolderContentsToPDF()
On Error GoTo err_FolderContents
Dim FirstLoop As Boolean
Dim DocList As String
Dim DocDir As String
Dim sPrinter As String

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
DocDir = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

sPrinter = ActivePrinter
ActivePrinter = "Adobe PDF"
Application.ScreenUpdating = False

FirstLoop = True

If Left(DocDir, 1) = Chr(34) Then
DocDir = Mid(DocDir, 2, Len(DocDir) - 2)
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList <> ""
Documents.Open DocList
ActiveDocument.PrintOut
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
DocList = Dir$()
FirstLoop = False
Loop
Application.ScreenUpdating = True
ActivePrinter = sPrinter
Exit Sub
err_FolderContents:
MsgBox Err.Description
Exit Sub
End Sub

or you could simply select the files in Windows Explorer and print them to
the Adobe driver.

If you don't have a PDF creation tool that does not require human
intervention - such as most of the free ones - then you will have to employ
someone to intervene when required. It might be cheaper to buy Acrobat ;)


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bob W

Well, Graham, your ingenious macro works fine - I tried it with a test folder
containing a dozen word docs. It asks which folder to look in; I specify
'test folder' where I have a dozen test.docs waiting to convert. Then it runs
in the background and feeds all the .docs to the PDF driver.

Alas, that's where the whole thing fails. Word's PDF driver jams "Save PDF
File as" dialogs and "hide the progress bar" dialogs in my face for each and
every document in the folder; after doing this a dozen times, the PDFs
generate, but Acrobat thinks every newly generated PDF now needs to be
triumphantly viewed, so window after window opens up as Acrobat creaks and
groans and displays each PDF.

So, the macro you provided works good, but Acrobat gets in the way like a
herd of elephants, clogging the batch conversion process to a standstill.
Guess I need to investigate further and see if there's any way to turn those
dialogs off. If I can figure out where the heck to do that. If it's even
possible.
 
D

Dawn Crosier, Word MVP

Bob -

Manually create a PDF document - when you are in your print dialog box
select properties for your Adobe PDF printer. On the Adobe PDF Settings
tab, clear the checkmark from View Adobe PDF Results.

That should do it for at least this printing session.

Good Luck.

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"
This message is posted to a newsgroup. Please post replies and questions
to the newsgroup so that others can learn as well.




Well, Graham, your ingenious macro works fine - I tried it with a test folder
containing a dozen word docs. It asks which folder to look in; I specify
'test folder' where I have a dozen test.docs waiting to convert. Then it runs
in the background and feeds all the .docs to the PDF driver.

Alas, that's where the whole thing fails. Word's PDF driver jams "Save PDF
File as" dialogs and "hide the progress bar" dialogs in my face for each and
every document in the folder; after doing this a dozen times, the PDFs
generate, but Acrobat thinks every newly generated PDF now needs to be
triumphantly viewed, so window after window opens up as Acrobat creaks and
groans and displays each PDF.

So, the macro you provided works good, but Acrobat gets in the way like a
herd of elephants, clogging the batch conversion process to a standstill.
Guess I need to investigate further and see if there's any way to turn those
dialogs off. If I can figure out where the heck to do that. If it's even
possible.

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date:
9/25/2007 8:02 AM
 
B

Bob W

Thanks Dawn, your post came in as I was rummaging through the print dialog. I
de-selected that check box as you suggested and also designated the desired
target folder for this test run; this time the conversion went OK; all PDFs
were generated unattended. What a time-saver!
 
D

Dawn Crosier, Word MVP

Bob -

Thanks for letting us know that all went well!

Congrats!

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"
This message is posted to a newsgroup. Please post replies and questions
to the newsgroup so that others can learn as well.




Thanks Dawn, your post came in as I was rummaging through the print dialog. I
de-selected that check box as you suggested and also designated the desired
target folder for this test run; this time the conversion went OK; all PDFs
were generated unattended. What a time-saver!


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date:
9/25/2007 8:02 AM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top