Monday, June 9, 2008

IMxDocument with Example

This interface is a starting point for much of the other objects in ArcMap. For example, this interface provides access to the current active view, the currently selected map, all of the maps, and the style gallery. This interface also has many properties reflected in the running application including: the text font, the text size, and the search tolerance. Almost every ArcMap customization uses IMxDocument one way or another.
Obtain a reference to this interface via IApplication::Document.
To edit the contents of a map document saved to a file (*.mxd) outside of an ArcMap session or without instantiating a new Application (ArcMap process), see IMapDocument. IMapDocument provides the ability to edit and save the contents of a map document.

[Visual Basic 6.0]
In ArcMap's VBA environment, the MxDocument object is exposed globally through ThisDocument (which supports IDocument). From this object you can obtain an IMxDocument reference. You can also obtain a reference to the same object through the Application object (which supports IApplication). The following VBA code shows both techniques. Dim pMxDocument As IMxDocument
Set pMxDocument = Application.Document
' or
Set pMxDocument = ThisDocument

No comments: