Domino Code Fragment

Code Name*
Determine whether a particular field in a form contains an object?
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.189.22.136
Description*
HasItemObject checks whether the field that is passed to this function contains an Object and then returns either True (hasObject) or False. A sample script is provided below.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sample Script:

Sub Click(Source As Button)
Messagebox hasItemObject("Bodyold")
End Sub


Function hasItemObject(itemname)
On Error Goto NoObject


Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim thisItem As NotesRichTextItem
'...set value of doc...
Set doc = ws.currentdocument.document
If doc.hasembedded Then
Set thisItem = doc.GetFirstItem( itemname )
' Messagebox Len(thisItem.EmbeddedObjects)
If (thisItem.EmbeddedObjects(0) Is Nothing) Then
Else
hasItemObject=True
Exit Function
End If
Else
hasItemObject=False
End If


NoObject:
hasItemObject = False
Resume Next
End Function