Afternoon,
Hope someone can give me a difinitive no this can’t be done or a yes and look at such and such!!!
We have a database with many attachments in rich text field. The attachments might have spaces within the names of the attachments. I have been asked to remove the spaces on the names of the attachments so that we can then place the attachments in specific folders. I started out by trying to determine how long the name of the attachment might be.
I have tried:
pre = doc.Body_1
Messagebox Len(pre), MB_OK, “Message”
And found that it will give me the length of any text within this field, but the attachment is not counted, so of course it is not counting the characters of the title of the attachement within the field. (Hope I haven’t lost you yet!!)
So with Hi and an attachment my message box says 2
With just an attachment my message box says 0.
Is there a different function that I can use to rename the attachment if needed within a rich text field???
TIA for any and all comments.
Teri
Subject: Len and Rich Text Fields
From the Help file (NotesEmbeddedObject class):
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim rtitem As Variant
Set db = New NotesDatabase( “SanFrancisco”, “hill.nsf” )
Set view = db.GetView( “All documents” )
Set doc = view.GetLastDocument
Set rtitem = doc.GetFirstItem( “Body” )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
Messagebox( o.Name )
End Forall
End If
And a note regarding the Name property:
For file attachments, this property returns the name of the file unless the attachment is a duplicate. If the attachment is a duplicate, this property returns an internal name. (The Source property returns the file name in all cases.)
There is also a NotesEmbeddedObject.ExtractFile method which will allow you to write the file to disk.
I wouldn’t bother re-naming them first - the ExtractFile method lets you set the name of the file - so you can get the Name or Source property, remove the spaces, then extract the file all in the same script.
Subject: RE: Len and Rich Text Fields
Thanks for the prompt response. I will work with this tomorrow.
Teri