Share via


Document.Type Property (2007 System)

Gets the document type (template or document).

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public ReadOnly Property Type As WdDocumentType
'Usage
Dim instance As Document 
Dim value As WdDocumentType 

value = instance.Type
public WdDocumentType Type { get; }
public:
property WdDocumentType Type {
    WdDocumentType get ();
}
public function get Type () : WdDocumentType

Property Value

Type: WdDocumentType
One of the WdDocumentType values.

Examples

The following code example displays a message that shows the document type.

This example is for a document-level customization.

Private Sub DocumentType()
    Select Case Me.Type
        Case Word.WdDocumentType.wdTypeDocument
            MessageBox.Show("The document is a normal" & "  Word document.")

        Case Word.WdDocumentType.wdTypeFrameset
            MessageBox.Show("The document is a frameset.")

        Case Word.WdDocumentType.wdTypeTemplate
            MessageBox.Show("The document is a template.")

        Case Else
            MessageBox.Show("The document type could not" & " be discovered.")
    End Select 
End Sub
private void DocumentType()
{
    switch (this.Type)
    {
        case Word.WdDocumentType.wdTypeDocument:
            MessageBox.Show("The document is a normal" +
            "  Word document.");
            break;

        case Word.WdDocumentType.wdTypeFrameset:
            MessageBox.Show("The document is a frameset.");
            break;

        case Word.WdDocumentType.wdTypeTemplate:
            MessageBox.Show("The document is a template.");
            break;

        default:
            MessageBox.Show("The document type could not" +
                " be discovered.");
            break;
    }
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace