Notes to PDF - my automated solution

This may have a limited audience, but I’ll share anyway since it works great for us. Caution: This solution uses the Adobe Acrobat PDFWriter printer driver, which may only be available with Acrobat Professional.

Problem: After updating 100 documents each week with new production data, we needed to create 100 individually named PDF files from the documents for emailing and storage in another database. Control + P was a tedious weekly chore.

Solution: We duplicated the look/feel/contents of each document by exporting each to a spreadsheet (100 sheets in 1 workbook). We used a document collection of unprocessed documents in a For loop. We start with the 3 sheets in excel and when our i > 2 and < dc.count, we start adding 1 sheet within the loop (so we don’t have extra unnamed sheets). Each sheet is named using a field value from the document plus some static text. Lotuscript handles the formatting, cell merging, background color, grid hiding, page break and field value exporting. It look 30 minutes over VPN to create 1 workbook with 100 sheets.

Once in Excel, we open up a second Excel file where we have the following macro saved. Switching back to the first sheet in our newly created Excel file, we then simply run the CreatePDFs macro and it creates 100 individually named PDF files in about 3 minutes. It also creates a second file with filetype of PATH. The PDF file works fine without this PATH file (and I never researched why it’s created or if it can be eliminated somehow).

Excel macro follows–

Sub CreatePDFviaExcelFile()

Dim ws As Worksheet

Dim PrToFileName As String

Dim shtName As Variant

ActivePrinter = “Acrobat PDFWriter on LPT1:”

For Each ws In Worksheets

FilePath = "J:\AgencyVisitPackage\BPTPlan\2008"

’ Adobe will automatically append the .PDF extension

shtName = ws.Name

Worksheets(shtName).Activate

PrToFileName = FilePath & shtName

Call ActiveSheet.PrintOut(, , , False, , True, , PrToFileName)

Next ws

End Sub