Embed Attachment when document is created

I have a view with an action button. The user clicks the button to open a new document.

They need an attachment to load into a Rich-Text Field.

It loads the attachment into the field just fine, except I can not use “Call Workspace.EditDocument” to open the form up for the user.

How can I load the attachment and have the form open afterward.

Here is what I have -

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set db = session.CurrentDatabase

Set doc = New NotesDocument( db )

Set rtitem = New NotesRichTextItem( doc, “ScoreSheet” )

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “M:\COMMON\Matt T\2008 Execution Results Evaluation Sheet.xls”)

doc.Form = “Work Request”

Call Workspace.EditDocument 'This line won’t work

Call doc.Save( True, True ) 'Also I don’t want to have to save

Thanks

Subject: RE: Embed Attachment when document is created

You can definitely do this. You do not have to save the document. You might have to call the Update method before you open the document.

If the above does not solve your problem, we need more information about what you’re doing. If you’re not sure what information to supply, the C R I S P Y document might help you. In particular, a more exact description of what you mean by “does not work” would be useful.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

Subject: Embed Attachment when document is created

doc.Form = "Work Request"Call doc.Save( True, True ) 'Also I don’t want to have to save

Call Workspace.EditDocument doc,…check the parameters in HELP

U will have to save the document, keep a flag before saving, delete this flag in the QuerySave event if the users chooses to save

A background agent can delete all docs that still have this field.