Rename and detach attachments in multiple rt fields
Posted on 2004-11-15
I have a form with multiple rich text fields each form does contain at least 1 embedded attachment.
For each rich text field (multiple rt fields exist i.e. more then 15 on the form).
I want to change the attached file name to DocNum & "_" & AttachName then put in a directory.
Prevously I have used the following code to extract a rich text item from a specific field but this form has multiple richtext fields.
Any help modify this code is needed fast!
If doc.HasEmbedded Then
Set rtitem = doc.GetFirstItem( "FormBodyNat" ) ' name of field to look for attachment
Forall o In rtitem.EmbeddedObjects
If o.Type = EMBED_ATTACHMENT Then
Call o.ExtractFile( "h:\data\RMs\"+ FName+".doc") ' check file path for new location
Call doc.Save( False, False) ' no save and no change in doc status