PDFCreator and LotusScript

Hello everyone,

I am using PDFCreator 0.9.3 as a third party tool to print PDF documents from NotesDocuments. I must handle the object creation error when the client running the application doesnt have PDFCreator installed.

I’ve tried doing something like this :

Dim PDFCreator As Variant

Set PDFCreator = CreateObject(“PDFCreator.clsPDFCreator”)

If PDFCreator Is Nothing Then

Msgbox “You must install PDFCreator to use this feature.”

Exit Sub

End If

Problem is that the error occurs on the CreateObject line (when PDFCreator is not installed). I would need some structure like Java’s try/catch, but unfortunately, I’m in LS. Please explain how to fix this.

Thanks in advance.

Subject: PDFCreator and LotusScript

You can disable error handling when you attempt to create the object which will suppress the error and then re-enable it after…example:

Dim PDFCreator As Variant

On Error Resume Next

Set PDFCreator = CreateObject(“PDFCreator.clsPDFCreator”)

On Error Goto 0

If PDFCreator Is Nothing Then

Msgbox “You must install PDFCreator to use this feature.”

Exit Sub

Subject: On Error Goto

Function CreatePDF() As BooleanOn Error Goto ErrorHandler

…

On Error Goto ErrorCreatingPDF

… try to create PDF

… switch back to generic error handler

On Error Goto ErrorHandler

CreatePDF =true

Exit sub/function

ErrorHandler:

…log error or whatever,

CreatePDF =false

Exit Function

ErrorCreatingPDF:

…tell user what to do

CreatePDF =false

Exit Function

End Function

Subject: Thank you very much guys, the help is very much appreciated. These 2 last posts fully answered my needs.