This documentation is archived and is not being maintained.

Document.UserControl Property

Office 2007
True if the document was created or opened by the user. Read/write Boolean.



expression   A variable that represents a Document object.


This property returns False if the document was created or opened programmatically from another Microsoft Office application with the Open method or the Visual Basic CreateObject or GetObject command.

Bb241633.vs_note(en-us,office.12).gif  Note
If Word is visible to the user or if you call the UserControl property from within a Word code module, this property will always return True.


This example displays the status of the UserControl property for the active document. This example will only work correctly when run from another Office application with the Word object library loaded.

Visual Basic for Applications
Set wd = New Word.Application
Set wdDoc = _
    wd.Documents.Open("C:\My Documents\doc1.doc")
If wdDoc.UserControl = True Then
    MsgBox "This document was created or opened by the user."
    MsgBox "This document was created programmatically."
End If