Bestehende pdf-Dokumente überschreiben

hallo,

ich meine gelesen zu haben, dass der pdf-creator bestehende dateien überschreibt.

leider funktioniert das bei mir nicht:

ich teste gerade  in access. mir geht es im moment nur um das überschreiben einer bestehenden datei. ist das möglich?

hier der getestete code:

'***********

Sub PrintToPDF_MultiWordDoc_to_SingleFile()

    Dim pdfjob As PDFCreator.clsPDFCreator
    Dim sPDFName As String
    Dim sPDFPath As String
    Dim sPrinter As String
    Dim lPrintOrder As Long
    Dim lDocs As Long
    Dim bRestart As Boolean
    Dim bBkgrndPrnt As Boolean

    'Activate error handling, capture properties and set req'd settings
    On Error GoTo EarlyExit
 

    '/// Change the output file name here! ///
    sPDFName = "Consolidated.pdf"
    sPDFPath = "C:\\"

    'Check if PDFCreator is already running and attempt to kill the process if so
    Do
        bRestart = False
        Set pdfjob = New PDFCreator.clsPDFCreator
        If pdfjob.cStart("/NoProcessingAtStartup") = False Then
            'PDF Creator is already running.  Kill the existing process
            Shell "taskkill /f /im PDFCreator.exe", vbHide
            DoEvents
            Set pdfjob = Nothing
            bRestart = True
        End If
    Loop Until bRestart = False

    'Assign settings for PDF job
    With pdfjob
        .cOption("UseAutosave") = 1
        .cOption("UseAutosaveDirectory") = 1
        .cOption("AutosaveDirectory") = sPDFPath
        .cOption("AutosaveFilename") = sPDFName
        .cOption("AutosaveFormat") = 0    ' 0 = PDF
        .cClearCache
    End With

    'Print documents to print queue in reverse order

    Dim i
    For i = 1 To 10
        DoCmd.OpenReport "rpt1"
        DoCmd.OpenReport "rpt2"
        lDocs = lDocs + 2
    Next i
  


    'Wait until all print jobs have entered the print queue
    Do Until pdfjob.cCountOfPrintjobs = lDocs
        DoEvents
    Loop

    'Combine all PDFs into a single file and stop the printer
    With pdfjob
        .cCombineAll
        .cPrinterStop = False
    End With

    'Wait until the file shows up before closing PDF Creator
    Do Until pdfjob.cCountOfPrintjobs = 0
        DoEvents
    Loop
   
   
    Do
        DoEvents
    Loop Until Dir(sPDFPath & sPDFName) = sPDFName

Cleanup:
    'Release objects and terminate PDFCreator
    pdfjob.cClose
    Set pdfjob = Nothing
    Shell "taskkill /f /im PDFCreator.exe", vbHide
    On Error GoTo 0

 
    Exit Sub

EarlyExit:
    'Inform user of error, and go to cleanup section
    MsgBox "There was an error encountered.  PDFCreator has" & vbCrLf & _
           "has been terminated.  Please try again.", _
           vbCritical + vbOKOnly, "Error"
    Resume Cleanup
End Sub

'**************************

 

 

für rückinfo wäre ich dankbar.

gruß aus der provinz

Hallo,

wass passiert denn, wenn die Datei nicht überschrieben wird?

Viele Grüße,

Philip