
Converting Word BookMarks to PDF Files
(I hate cross posting, but it does pertain to PDFs and Word)
I have a Word97 macro that scans a file and breaks it into bookmarks. I
then need to loop thru the bookmarks and create individual PDFs.
I'm having trouble with the code to automate the creation of the individual
PDFs.
I'm using a combination of the SendKeys to the active printer as such:
Sub SendToPDF(ByVal OutPutFile As String)
Dim PDFFile As String
Dim DateSfx As String
'
' SendToPDf Macro
' Macro recorded 06/11/01 by Nicholas C. Osdale-Popa
'
DateSfx = Format(DateStamp, "mm-dd-yy")
PDFFile = OutPutFile & "-" & DateSfx & ".PDF"
If FileExists(SAVEDIR, PDFFile) Then
Kill SAVEDIR & "\" & PDFFile
DoEvents
End If
ActivePrinter = "Acrobat PDFWriter"
SendKeys SAVEDIR & "\" & PDFFile & "{ENTER}"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False
End Sub
The main problem with this is that Acrobat starts to run after the first
file is made.
I would like to use the Acrobat Object (if one exists) to make the files,
rather than using the clumsy SendKeys.
I'm using Word97 and Acrobat 5.0
Thanks.