Save an attachment to Disk

Hello,Anybody have any code for save an attachment of a document on the disk?

I need to save the file in order to upload it to a FTP server.

Thank you sou MUCH!

Subject: Save an attachment to Disk

Dim doc As NotesDocumentDim rtitem As Variant

Dim fileCount As Integer

Dim embed As NotesEmbeddedObject

Set rtitem = doc.GetFirstItem( “Body” )

Set embed = rtitem.GetEmbeddedObject(“attachmentname”)

Call embed.ExtractFile ( “c:\reports\newfile” )

Subject: RE: Save an attachment to Disk

Thanks! but something is wrong in the code or in me because in the line…7 i get an error.

Dim embed As NotesEmbeddedObject

Dim docAs NotesDocument

Dim sessionAs NotesSession

Set session = New NotesSession

Set doc= session.DocumentContext

Set rtitem = doc.GetFirstItem( “Body” )

THIS LINE!----->Set embed = rtitem.GetEmbeddedObject(“upload.zip”)<------- Error Message.

Call embed.ExtractFile ( “c:\reports\newfile” )

The Error Message is: Object variable not set

Anybody can help me?

Than you very much.

Subject: RE: Save an attachment to Disk

make sure you call the agent from the webquerysave event. Otherwise Set doc= session.DocumentContext might not work as expected.