Share via


DocumentBase.Type Property

Definition

Gets the document type (template or document).

public:
 property Microsoft::Office::Interop::Word::WdDocumentType Type { Microsoft::Office::Interop::Word::WdDocumentType get(); };
public Microsoft.Office.Interop.Word.WdDocumentType Type { get; }
member this.Type : Microsoft.Office.Interop.Word.WdDocumentType
Public ReadOnly Property Type As WdDocumentType

Property Value

One of the WdDocumentType values.

Examples

The following code example displays a message that shows the document type. To use this example, run it from the ThisDocument class in a document-level project.

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;
    }
}
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

Applies to