Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Problems with PDFCreator

Hello there

I'm using the code below from Ken Puls to create a pdf from a multiple sheet
workbook. With some books it's just fine and with others it won't release at
the end. I've put Ken's fix about wait time and adjusted from 0 to 10 minutes
and just about everything in between, but no go. Does anyone have any ideas.

Alternatively, how can I get PDFCreator to add a page or two to an existing
file, or is this only available with PrimoPDF?

Thanks, Brett

CODE USED:
Option Explicit
Sub MULTISHEET_PDF() 'EARLY BINDING
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
Dim lSheet As Long
Dim lTtlSheets As Long

sPDFName = Range("pdf.name")
sPDFPath = ActiveWorkbook.Path & Application.PathSeparator
Set pdfjob = New PDFCreator.clsPDFCreator

If pdfjob.cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + vbOKOnly, "Error!"
Exit Sub
End If

With pdfjob
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0
.cClearCache
End With

lTtlSheets = Application.Sheets.Count
For lSheet = 1 To Application.Sheets.Count
On Error Resume Next
If Not IsEmpty(Application.Sheets(lSheet).UsedRange) Then
Application.Sheets(lSheet).PrintOut copies:=1,
ActivePrinter:="PDFCreator"
Else
lTtlSheets = lTtlSheets - 1
End If
On Error GoTo 0
Next lSheet

Do Until pdfjob.cCountOfPrintjobs = lTtlSheets
DoEvents
Loop

With pdfjob
.cCombineAll
.cPrinterStop = False
End With

Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
Application.Wait Now + TimeValue("0:0:10")

pdfjob.cClose
Set pdfjob = Nothing
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
More zip + 4 problems dm Excel Discussion (Misc queries) 1 September 11th 06 11:28 PM
Problems with MAX Carlo Excel Worksheet Functions 6 September 5th 06 12:51 PM
Two Problems Aoife Excel Discussion (Misc queries) 2 April 10th 06 02:44 AM
problems with? I don't know cliffhanger79 Excel Discussion (Misc queries) 1 November 4th 05 01:47 PM
SP3 problems Ron Weaver Excel Discussion (Misc queries) 3 March 19th 05 04:57 PM


All times are GMT +1. The time now is 07:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"