Programmatically 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 VSTO Add-in projects for Excel. For more information, see Features available by Office application and project type.
To open an existing workbook
Compile the code
This code example requires the following:
- A workbook named
YourWorkbook.xls
must exist in a directory namedTest
on drive C.
Related content
- Work with workbooks
- How to: Programmatically open text files as workbooks
- How to: Programmatically create new workbooks
- How to: Programmatically save workbooks
- How to: Programmatically close workbooks
- Programmatic limitations of host items and host controls
- Optional parameters in Office solutions
- Host items and host controls overview
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for