@Glombi:
Herzlichen Dank,
das schaut doch schon sehr brauchbar aus.
Ich habe aber noch ein Problem, nämlich die Fehlermeldung :
External Function not Found
Der Fehler passiert wenn er SetDefaultPrinter aufruft.
In den Options habe ich folgende Zeile
Declare Function SetDefaultPrinter Lib "winspool.drv" Alias "SetDefaultPrinterA" (Byval pszPrinter As String) As Long
Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (Byval lpAppName As String, Byval lpKeyName As String, Byval lpDefault As String, Byval lpReturnedString As String, Byval nSize As Long) As Long
Die winspool.drv befindet ebenfalls im System Verzeichnis von Windows
Das ist der Code
Function PrintToPDF
Dim CurPrinter As String
Dim retval As Long
CurPrinter = GetCurrentPrinter
retval = SetDefaultPrinter("FinePrint 2000") ' you will enter here the full name of the printer, including the server if printer is on network; you can find the name by looking at printer options in any printing menu, say, in Word;
If retval <> 0 Then
Msgbox "This document is now transferred to PDF format.", 64, "PDF action"
'the message box is a necessary trick to interrupt execution for printer swapping. The doc will print on the old printer if this interruption is not in place; you can replace it with a Yes/No box:
'flag = Msgbox ("Do you want to store this document as PDF?", 4 + 32, "PDF action")
'If flag = 7 Then
'Call SetDefaultPrinter(CurPrinter)
'Exit Function
'End If
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Call uidoc.Print(1,,,)
Else
Msgbox "Cannot create PDF compatible printer driver"
End If
Call SetDefaultPrinter(CurPrinter)
End Function
Hat jemand eine Idee ?
Ciao
Don Pasquale