Examples: EmbedObject method

  1. This script creates a new document in the current database, creates a new rich text item called Body on the document, and attaches the file JIM.SAM to the Body. It then sets the value of the Form and Subject items on the document and saves it.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim rtitem As NotesRichTextItem
    Dim object As NotesEmbeddedObject
    Set db = session.CurrentDatabase
    Set doc = New NotesDocument( db )
    Set rtitem = New NotesRichTextItem( doc, "Body" )
    Set object = rtitem.EmbedObject _
    ( EMBED_ATTACHMENT, "", "c:\jim.sam")
    doc.Form = "Main Topic"
    doc.Subject = "Here's Jim's document, as an attachment"
    Call doc.Save( True, True )
  2. This script is identical to the one above, except that it creates an embedded object using the file .JIM.SAM
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim rtitem As NotesRichTextItem
    Dim object As NotesEmbeddedObject
    Set db = session.CurrentDatabase
    Set doc = New NotesDocument( db )
    Set rtitem = New NotesRichTextItem( doc, "Body" )
    Set object = rtitem.EmbedObject _
    ( EMBED_OBJECT, "", "c:\jim.sam")
    doc.Form = "Main Topic"
    doc.Subject = _
    "Here's Jim's document, as an embedded object"
    Call doc.Save( True, True )
  3. This script is identical to the one above, except that it creates an object link using the file .JIM.SAM
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim rtitem As NotesRichTextItem
    Dim object As NotesEmbeddedObject
    Set db = session.CurrentDatabase
    Set doc = New NotesDocument( db )
    Set rtitem = New NotesRichTextItem( doc, "Body" )
    Set object = rtitem.EmbedObject _
    ( EMBED_OBJECTLINK, "", "c:\jim.sam")
    doc.Form = "Main Topic"
    doc.Subject = "Here's Jim's document, as an object link"
    Call doc.Save( True, True )
  4. This script embeds a new, blank embedded object in the Body item of a document. The object is created using 1-2-3.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim rtitem As NotesRichTextItem
    Dim object As NotesEmbeddedObject
    Set db = session.CurrentDatabase
    Set doc = New NotesDocument( db )
    Set rtitem = New NotesRichTextItem( doc, "Body" )
    Set object = rtitem.EmbedObject _
    ( EMBED_OBJECT, "1-2-3 Worksheet", "", _
    "Quarterly Report" )
    Call doc.Save( True, True )