Skip to Main Content
Word 2007 Document Automation with VBA and VSTO
book

Word 2007 Document Automation with VBA and VSTO

by Scott Driza
March 2009
Intermediate to advanced content levelIntermediate to advanced
617 pages
17h 24m
English
Jones & Bartlett Learning
Content preview from Word 2007 Document Automation with VBA and VSTO
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Word 2003 Document Automation with VBA, XML, XSLT, and Smart Documents

Word 2003 Document Automation with VBA, XML, XSLT, and Smart Documents

Scott Driza

Publisher Resources

ISBN: 9781598220476