Applies to |
|---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Project type Microsoft Office version For more information, see Features Available by Application and Project Type. |
You can refer to a Microsoft.Office.Interop.Word..::.Document object as a member of the Documents collection by using the name of the document or its index value in the collection.
Referring to a document by its name is usually the better choice if you want to work with a specific document. You rarely refer to a document by using its index value in the Documents collection because this value can change for a given document as other documents are opened and closed.
To reference a document by its name
If you want to refer to the active document (the document that has focus), you can use the ActiveDocument property of the Application object.
To reference the active document
If you are only working with the document that is associated with a document-level customization, you can use the Globals.ThisDocument reference from anywhere in the project when you need to refer to the document that has the focus.
To reference the document associated with a document-level customization
Tasks
Concepts