Documents Collection Object

If your application supports a multiple-document interface (MDI), you should provide a Documents collection object. Use the name Documents for this collection, unless the name is inappropriate for the application.

The Documents collection object should have all of the following properties.

Property name Return type Description
Application VT_DISPATCH Returns the Application object; read only. Required.
Count VT_I4 Returns the number of items in the collection; read only. Required.
_NewEnum VT_DISPATCH A special property that returns an enumerator object that implements IEnumVARIANT. Required.
Parent VT_DISPATCH Returns the parent of the Documents collection object; read only. Required.

The Documents collection object should have all of the following methods.

Method name Return type Description
Add VT_DISPATCH Creates a new document and adds it to the collection. Returns the document that was created. Required.
Close VT_EMPTY Closes all documents in the collection. Required.
Item VT_DISPATCH or VT_EMPTY Returns a Document object from the collection or returns VT_EMPTY if the document does not exist. Takes an optional argument, index, which may be a string (VT_BSTR) indicating the document name, a number (VT_I4) indicating the ordered position within the collection, or either (VT_VARIANT). If index is omitted, returns the Document collection. The Item method is the default member (DISPID_VALUE). Required.
Open VT_DISPATCH
or VT_EMPTY
Opens an existing document and adds it to the collection. Returns the document that was opened, or VT_EMPTY if the object could not be opened. Takes one required argument, filename, and one optional argument, password. Both arguments have the type VT_BSTR. Required.