Extract LN Email attachments

Hi, Im using the following code to Extract LN Email attachments. It is extracting correctly but only issue is, the agent is not saving the attchment if the attachment is of same name though it is in different email.

Sub Initialize

Dim s As New NotesSession

Dim db As NotesDatabase

Dim coll As NotesDocumentCollection

Dim doc As NotesDocument

Dim eo As NotesEmbeddedObject

Dim RTITEM As NotesRichTextItem

Set db=s.CurrentDatabase

Set coll=db.UnprocessedDocuments

For a=1 To coll.count

Set doc=coll.GetNthDocument(a)

Set rtitem = doc.GetFirstItem(“Body”)

If Not IsEmpty(rtitem.embeddedObjects) Then

If Dir$(“c:Attachment Files”,16) = “” Then

MkDir “c:Attachment Files”

folderpath =“c:Attachment Files”

Else

folderpath =“c:Attachment Files”

End If

ForAll o In rtitem.EmbeddedObjects

oname=folderpath+“”+o.name

Call o.ExtractFile(oname)

Print o.name

MessageBox o.name

Call rtitem.AddNewLine( 2 )

Call rtitem.AppendText(( "Your file was downloaded to " +folderpath+ " as

filename: " ) & o.name)

Call doc.Save( False, True )

End ForAll

End If

Next

End Sub

can anyone pls help me…

one more issue i found is, If I schedule this agent, the agent log ends with an error message : Path not found. Where in if I run the agent from Action Menu Selection no problem.

Any sugg reg this??

Subject: You have already asked this question in the Notes 6/7 forum…

And gotten responses as well.