Listing A
'Determines whether the current or passed object
'is open or closed.
Public Function ObjState(Optional objname As Variant, _
    Optional objtype As Variant) As Integer
  'determine whether the object is
  'selected or passed via arguments
  Dim intState As Integer
  If IsMissing(objname) = True Then
  'if using current object
    ObjState = SysCmd(acSysCmdGetObjectState, _
       Application.CurrentObjectType, _
        Application.CurrentObjectName)
  'if using passed argument
  Else
    ObjState = SysCmd(acSysCmdGetObjectState, _
        objtype, objname)
  End If
End Function