This is my code snippet to cycle thru a list of potential filepaths that the user may choose to include as attachments in a LS generated email message:
If addedlist(0) <> “” Then
Forall y In addedlist
'check to see if this file was selected
pos = Arraygetindex(selections, y)
If Not(Isnull(pos)) Then
'this file was selected, so attach it to the mail msg
Set rtitemtemp = New NotesRichTextItem( doc, “TempBody” )
Set object = rtitemtemp.EmbedObject ( EMBED_OBJECT, “”, y )
If( object Is Nothing ) Then
Messagebox "Error creating attachment: " & y
Else
Call rtitem.AppendRTItem( rtitemtemp )
End If
End If
End Forall
End If
After this code runs, the current uidoc is printed in PDF format and appended as the last attachment. The email is sent fine if I do not select any additional files to include. However, if I select an additional file, the above code will add the file with the wrong file name. For example, I tried to attach c:\bobp\excel files\camping.xls I don’t receive an error, but in the debugger, it shows the embedded object Name in my rtitem as EXT64432.
Naturally, the email is not sent, and I suspect it’s because it cannot find the file EXT64432 when it tries to send the msg.
Why would LS rename the file when it embeds it? I don’t understand… what am I missing?
Thanks in advance for any advice…
(I also tried to attach a file where there were no spaces in the filepath and got the same result)
btw - this is the code to add the pdf file of the printed uidoc to the email. It always shows the correct filename in the rtitem in debugger:
'print the quote to the pdf printer
Call uidoc.Print(1)
Sleep (4) 'to make sure the pdf is finished printing
Set rtitemtemp = New NotesRichTextItem( doc, “TempBody” ) 'to clear its contents
filename = "c:\pdf995\output" & uidoc.WindowTitle & “.pdf”
Set object = rtitemtemp.EmbedObject ( EMBED_ATTACHMENT, “”, filename)
Call rtitem.AppendRTItem(rtitemtemp)