Udostępnij za pośrednictwem


How to: Open Workbooks

The Workbooks collection in Microsoft Office Excel makes it possible to work with all open workbooks and to open workbooks.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

To open an existing workbook

  • Use the Open method of the Workbooks collection, passing in the path to the workbook.

    Me.Application.Workbooks.Open("C:\Test\YourWorkbook.xls")
    
    this.Application.Workbooks.Open(@"C:\Test\YourWorkbook.xls",
        missing, missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing,missing, missing);
    

Compiling the Code

This code example requires the following:

  • A workbook named YourWorkbook.xls must exist in a directory named Test on drive C.

See Also

Tasks

How to: Open Text Files as Workbooks

How to: Create New Workbooks

How to: Save Workbooks

How to: Close Workbooks

Concepts

Working with Workbooks

Programmatic Limitations of Host Items and Host Controls

Optional Parameters in Office Solutions

Host Items and Host Controls Overview