WorkbookBase.FileFormat Property

Definition

Gets the file format and type of the workbook.

public:
 property Microsoft::Office::Interop::Excel::XlFileFormat FileFormat { Microsoft::Office::Interop::Excel::XlFileFormat get(); };
public Microsoft.Office.Interop.Excel.XlFileFormat FileFormat { get; }
member this.FileFormat : Microsoft.Office.Interop.Excel.XlFileFormat
Public ReadOnly Property FileFormat As XlFileFormat

Property Value

One of the XlFileFormat values.

Examples

The following code example checks the value of the FileFormat property to determine whether the workbook is a normal workbook. If the workbook is a normal workbook, then the example calls the SaveAs method to resave the workbook as an XML spreadsheet with the name XMLCopy.xlsx in the path specified by the Path property.

This example is for a document-level customization.

private void WorkbookSaveAs()
{
    if (this.FileFormat == Excel.XlFileFormat.xlWorkbookNormal)
    {
        this.SaveAs(this.Path + @"\XMLCopy.xml",
            Excel.XlFileFormat.xlXMLSpreadsheet,
            false, false, Excel.XlSaveAsAccessMode.xlNoChange);
    }
}
Private Sub WorkbookSaveAs()
    If Me.FileFormat = Excel.XlFileFormat.xlWorkbookNormal Then
        Me.SaveAs(Me.Path & "\XMLCopy.xml", _
            Excel.XlFileFormat.xlXMLSpreadsheet, _
            AccessMode:=Excel.XlSaveAsAccessMode.xlNoChange)
    End If
End Sub

Applies to