18.01.2013 Views

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Set rtitem = doc.GetFirstItem ("Object")<br />

If rtitem.Type = RICHTEXT Then<br />

Forall o In rtitem.EmbeddedObjects<br />

End If<br />

End Sub<br />

Set object = rtitem.GetEmbeddedObject<br />

(o.Name)<br />

End Forall<br />

Set handle = object.Activate (True)<br />

10. Save this <strong>for</strong>m and close it.<br />

Following is a description of the <strong>LotusScript</strong> code:<br />

Declare collection as an object reference variable of the<br />

NotesDocumentCollection class.<br />

Dim collection As NotesDocumentCollection<br />

Assign collection as a reference variable to all documents in the current<br />

database.<br />

Set collection = db.AllDocuments<br />

Declare object as an object reference variable of class<br />

NotesEmbeddedObject.<br />

Dim object As NotesEmbeddedObject<br />

Assign doc as a reference variable to the seventh document in the collection<br />

of documents.<br />

Set doc = collection.GetNthDocument (7)<br />

Assign rtitem as a reference variable to the object item in the current<br />

document.<br />

Set rtitem = doc.GetFirstItem ("Object")<br />

The following statement tests the rtitem variable to see if it is rich text or<br />

not.<br />

If rtitem.Type = RICHTEXT<br />

This statement assigns object as a reference variable to an object name in the<br />

object rich text item.<br />

Set object = rtitem.GetEmbeddedObject (o.Name)<br />

Chapter 12: Using Notes as an OLE 2 Automation Client: Managing Objects 195

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!