Workbook.Path Property (2007 System)

Gets the complete path to the application, excluding the final separator and name of the application.

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

Syntax

'Declaration
Public ReadOnly Property Path As String
'Usage
Dim instance As Workbook 
Dim value As String 

value = instance.Path
public string Path { get; }
public:
property String^ Path {
    String^ get ();
}
public function get Path () : String

Property Value

Type: System.String
The complete path to the application, excluding the final separator and name of the application.

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.xls in the path specified by the Path property.

This example is for a document-level customization.

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

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace