Can I insert an attachment into notes document from a button

Hi

We have a news database. We allow people to make one of the news item the ‘featured story’. The featured story must have an attachment in a certain field.

I have got to the point where I am able to test the field for an attachment and if it is blank pop up an alert but am unsure where to go next.

Here is the code so far…

Sub Click(Source As Button)

Dim session As New notessession

Dim db As notesdatabase

Set db = session.CurrentDatabase

Dim docCollection As notesdocumentcollection

Set docCollection = db.unprocesseddocuments

If docCollection Is Nothing Or docCollection.Count = 0 Then

Messagebox “Please select document(s)”

Exit Sub

End If

If docCollection.Count > 1 Then

Messagebox “Please select only one document”

Exit Sub

End If

Dim doc As notesdocument

Set doc = docCollection.GetFirstDocument

Dim rtitem As NotesRichTextItem

Set rtitem = doc.GetFirstItem( “image1” )

NotesEmbeddedObjectArray = rtitem.EmbeddedObjects

If Isempty ( NotesEmbeddedObjectArray ) Then

Messagebox “Featured items need a thumbnail graphic. Do you want to add a thumbnail graphic?”

continue=False

Exit Sub

End If

End Sub

Any help would be appreciated, even if it is just cofirming that I can’t do what I want to do.

Thanks

Paul

Subject: Yes

This is a common question and there are numerous examples of how this is done in this forum.

I suggest that you locate the procedure by Andre Guirard. Not sure if it’s in the 8 forums but it’s definitely in the 6 and 7.