Link to home
Start Free TrialLog in
Avatar of koray_uygun
koray_uygun

asked on

EmbeddedObjects,attachments and Excel

Hi all!
I am sending an .xls document throught Excel to a Mail-in database. There i want to "take" this embeddedobjects (or attachments, what ever) and embed them in a richtext field of a new document.
In the properties of the doc containing the ecel file, HASEMBEDDED=True but EMBEDDEDOBJECTS is empty so when i try :
forall o in doc.embeddedobjects
it says Type Mismatch.
Can some one give me a code to do this?
Thank you,
Koray.
Avatar of koray_uygun
koray_uygun

ASKER

Adjusted points from 100 to 150
Adjusted points from 150 to 200
Adjusted points from 200 to 300
If the document was mailed into the database via a excel to a mail in database then I think the attachment will be in the body field of the document not in the document itself

So you should change the code to

Dim Wspace As New NotesWorkspace
Dim uiDoc As Notesuidocument
Dim Doc As NotesDocument
Dim rtitem As NotesRichTextItem


Set uiDoc = Wspace.CurrentDocument
Set Doc = uiDoc.Document
Set rtitem = Doc.GetFirstItem( "Body" )

forall o in rtitem.embeddedobjects
.......
End Forall


Give this a go and get back to me....
Adjusted points from 300 to 350
Sorry Simon, the problem is that this attachment is not in the body field, that's why i can't "take" it. The attachment is like "under" the document separeted from it by an horizontal line.
Thank you for trying,
Koray.
Ok , Sorry now I understand your question... Yes this is a tricky one because the embeddedobjects array does not contain these attachments , the same type of thing occurs when you upload files from the web via an upload control... Here the code to use...


Dim Wspace As New NotesWorkspace
Dim uiDoc As Notesuidocument
Dim Doc As NotesDocument
Dim rtitem As NotesRichTextItem

     Set Doc = uiDoc.Document
     Forall i In doc.Items
          If i.type = Attachment Then
               Set nitem = doc.GetFirstItem(i.name)
               Set emb = doc.GetAttachment(i.values(0))
               Set rtitem=doc.getfirstitem("Body")
               Call emb.extractfile("C:\" & emb.name)
               Call rtitem.embedobject(EMBED_Attachment, "", "C:\" & emb.name, emb.name)
               Call emb.remove
          End If
     End Forall

This code gets the attahment from "under" the document seperator and moves it into the body field of the document... Hope I got it right this time
In the first line it should be notesuiworkspace not notesworspace... Sorry typo
Sorry again Simon,
i have tried this one already and it doesn't work. There isn't any item whos type is attachment in the incoming mail. The attachment file is in an item called $File whos type is not Attachment and when i try to "take" the value of $File, the script can't find the item in the document, it is really strange.
Have a nice day,
Koray.
I am now fascinated by this , is it possible that you can e-mail me a copy of this database with a single example document in it ??

If it is to secure I understand

Simon Hendry
Ok, i'll send a copy tuesday, Have a nice "Paques" (eggs) week-end,
Koray.
shendry@families.qld.gov.au
ASKER CERTIFIED SOLUTION
Avatar of Simon_Hendry
Simon_Hendry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Halleluiah!!!
Thank you very much.
By the way, do you think there's work for a french Lotus Notes certified developper in australia?