Declare Function DoPDF Lib "DOMINOPDF.DLL" (Byval szInput As String, Byval szOutput As String, Byval szOptions As String) As Long
Sub Initialize
Dim oSession As New NotesSession
Dim oDB As NotesDatabase
Dim oView As NotesView
Dim oDoc As NotesDocument
Dim oAttach As NotesEmbeddedObject
Dim sAttach As String
Set oDB = oSession.CurrentDatabase
Set oView = oDB.GetView("($All)")
Set oDoc = oView.GetFirstDocument
While Not oDoc Is Nothing
If oDoc.Form(0) = "Memo" Then
sAttach = ""
Forall i In oDoc.Items
If i.Type = Attachment Then
Set oAttach = oDoc.GetAttachment(i.Values(0))
Call oAttach.ExtractFile(oAttach.Name)
sAttach = sAttach & oAttach.Name & ";"
End If
End Forall
If sAttach <> "" Then
sAttach = Mid$(sAttach, 1, Len(sAttach) - 1)
Call DoPDF(sAttach, oDoc.UniversalID & ".pdf", "")
End If
End If
Set oDoc = oView.GetNextDocument( oDoc )
Wend
End Sub