
Using Properties and Methods
The ActiveDocument property is used to return the Document
object that represents the document with the focus. The
ActiveDocument property is read-only, so it cannot be used to
give the focus to a particular document (use the Activate
method to give focus to a particular document). If there are no
documents open, an error will occur if this property is refer-
enced. You can avoid this error by checking to see that a
document is actually open by using the Count property of the
Documents collection. For example:
If Documents.Count > 0 then
MsgBox ActiveDocument.Name
Else
MsgBox "There are no documents open!"
End If
You will find ...