Notes Object - Attach Mulitple Doc's - Back End

I have an LotusScript action that allows a user to select multipe file attachments and attach them to a “new” email. The multiple files are selected via a picklist with the Doc Id’s being returned.

Once I have the doc Id’s I loop through all the documents, extract the file attachment, embed the file attachment to the memo, and the open the uidoc in edit mode.

When I do this with the debugger on it works fine, all selected files are visible. When I do this without the debugger it doesn’t work properly.

For example, I select 3 attachments to be included on this new email, using a pickListString:

'prompt user with a list of all EE Docs- col 6 in view is doc id

stringArray = wsG.PickListStrings( 3, True , sServerG, dbG.FilePath, "vwDC_EEDocsByTypeCat", "Transferee Documents", "Select Documents", 6)

(The stringArray varible is returning the correct values)

It attaches all 3 documents, but 1 of the 3 attachments aren’t correct. Two attachments are proper, then the 3rd one has a bogus file name, ie ATLLUO4T, and can’t be opened.

Here is the code where I am looping and attaching the documents, then open the document in edit mode:

'declare the body on the new Memo.

Dim RTI As New NotesRichTextItem( Memo, “body” )

'loop through the stringArray which consists of docid’s

Forall x In stringArray

	Set attDoc = dbG.GetDocumentByUNID( x )

'error trap to see if the doc exists and if the doc has an attachment

	If attDoc Is Nothing Goto NextForall

	If attDoc.DC_FileNameTx(0)="" Goto NextForAll

'get the attachment from the body of the mail

	Set nEO = attDoc.GetAttachment( attDoc.DC_FileNameTx(0) )	

'extract the file to the C drive

	Call nEO.ExtractFile( "C:\"+attDoc.DC_FileNameTx(0) )		

'embed the attachment into the memo document

	Set object = RTI.EmbedObject ( EMBED_ATTACHMENT, "",  "C:\"+attDoc.DC_FileNameTx(0) )

	Kill  "C:\"+TempATT.DC_FileNameTx(0)

	

	Set object = Nothing

NextForall :

End Forall

'Open the memo in edit mode.

Set UMemo=wsG.EditDocument(True,Memo)

Any ideas? Or a better way to allow users to select multiple documents via the backend and open it up in edit mode?

Thanks for the help. Anything is appreciated.