Open a PDF - Embeded in a form

This agent when run will goto a view select the top document grab the pdf from the embedded field.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim ws As New NotesUIWorkspace



Dim doc2 As NotesDocument

Dim view As NotesView

	

Dim rtitem As Variant

Dim object As NotesEmbeddedObject

Dim object2 As NotesEmbeddedObject

Dim userPath As String

userPath = Environ("UserProfile") ' grabs the path to save the file



		'get form and activate

Set db = session.CurrentDatabase	

Set view = db.GetView("orgchart")

Set doc2 = view.GetDocumentByKey("orgchart", False)

Set rtitem = doc2.GetFirstItem( "orgchart" )

Set object2 = rtitem.EmbeddedObjects(0)

Set object = doc2.GetAttachment(object2.name)



Call object.ExtractFile( userPath+"\orgchart.pdf" )



Call ws.URLOpen( userPath+"\orgchart.pdf" )

End Sub

This works in windows 7 using lotus 8.5.1

Had to rewrite my old lotus 5 script

So I posted the new script here.