Hi all,
In a database of mine I have lots of documents with one object (mostly Word documents and Excel spreadsheets) in each of them. Now I need to save all these objects as files. Because of the number of documents it is impossible to do so manually. Do you know how to do this in the best way programmatically? Probably I will have to compose a lotusscript which also uses VBA? Have you a script - or at least an idea - which can solve my problem?
Hoping to hearing from you. Thank you very much in advance.
Jo
Subject: Saving lots of objects programmatically
You can write a Lotusscript that uses the EmbeddedObjects property to scan them. given their name you have a way to save them on the filesystem.
Subject: RE: Saving lots of objects programmatically
That’ll work for attachments, but OLE embeds are going to be a problem. The data stored in the document by an OLE embed by Microsoft product controls is only a subset of the compound document that would appear in a “real” file. MS has published the file spec for Office programs, and you can create Office files (.doc, .xls, etc.) using the embedded object data – but it just may be cheaper to have people to do it manually.
Subject: RE: Saving lots of objects programmatically
Hi Rob,
I can scan them & find their names, yes - but how do I save them to the file system? As far as I can see the ExtractFile method of the EmbeddedObject class only works for attachments, not for objects. I do not find any method working for objects. Does that mean that I have to open the object and run a VBA script which saves the document in the object from within the LotusScript?
Hoping to hearing from you.
Jo
Subject: RE: Saving lots of objects programmatically
I believe that you can get objects with GetEmbeddedObject. Attachments can be obtained via NotesDocument.GetAttchment
Here is some code from the Designer’s help:
Dim doc As NotesDocument
Dim rtitem As Variant
Dim object As NotesEmbeddedObject
'…set value of doc…
Set rtitem = doc.GetFirstItem( “Body” )
If ( rtitem.Type = RICHTEXT ) Then
’ check for attachment in Body item
Set object = rtitem.GetEmbeddedObject( “jill.sam” )
If ( object Is Nothing ) Then
' check for attachment in rest of document
Set object = doc.GetAttachment( "jill.sam" )
End If
End If
Subject: RE: Saving lots of objects programmatically
You can GET OLE embeds, yes, but you can’t do much with them. Activate and DoVerb are the only methods available, and neither is much good for the required task unless there’s UI interaction. And going through the EmbeddedObjects collection of a Rich Text item is a legitimate method for handling attachments.