How to: Open Workbooks
Applies to |
---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Project type
Microsoft Office version
For more information, see Features Available by Application and Project Type. |
The Workbooks collection in Microsoft Office Excel makes it possible to work with all open workbooks and to open workbooks.
To open an existing workbook
Use the Open(String, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) 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
Concepts
Programmatic Limitations of Host Items and Host Controls
The Variable missing and Optional Parameters in Office Solutions