例: Activate method

  1. 次のスクリプトは文書の Body アイテムに新規のオブジェクトを埋め込み、埋め込みオブジェクトを起動します。
    Dim session As New NotesSession
    Dim doc As NotesDocument
    Dim rtitem As NotesRichTextItem
    Dim object As NotesEmbeddedObject
    Dim handle As Variant
    Set doc = New NotesDocument( session.CurrentDatabase )
    Set rtitem = New NotesRichTextItem( doc, "Body" )
    Set object = rtitem.EmbedObject _
    ( EMBED_OBJECT, "Microsoft Excel Worksheet", "", _
    "Report" )
    Set handle = object.Activate( False )
    If ( handle Is Nothing ) Then
      doc.Subject = "This object has no OLE automation interface"
    Else
      doc.Subject = "This object has an OLE automation interface"
    End If
    Call doc.Save( True, True )
  2. 次のスクリプトはリッチテキストアイテムに新規のワークシートを埋め込みます。また、埋め込みオブジェクトを起動して、そのハンドルを使用してワークシートのセルに値を設定します。
    Dim rtitem as NotesRichTextItem
    Dim object as NotesEmbeddedObject
    Dim handle as Variant
    '...set value of rtitem...
    Set object  = rtitem.EmbedObject( EMBED_OBJECT, _
    "Microsoft Excel Worksheet", "", "Report" )
    Set handle = object.Activate ( False )
    handle.Application.Cells( 1,1 ).Value = 100
    handle.Parent.Save