Open Excel Workbook Using VBA Macros

Add to Favorites

Simple way to open an Excel workbook using VBA and macros.

Syntax

Workbooks.Open ("File Path")

Replace file path with the path to the file on your computer along with the full file name.

Here is what it looks like in the VBA Editor window:

Note: you do not always have to use the file extension of the file but it is a good practice to do so. In my example, using simply "D:\test" would also work.

Notes

There are MANY more options for opening a workbook but this post covers the basic usage of it, which will work for 98% of needed uses for this.

Here is a link to a full explanation on using this method if you need a more complex implementation of it: Workbook Open Method.

Make sure to download the accompanying workbooks to test this out in Excel.


Downloadable Files: Excel File 1, Excel File 2

Similar Content on TeachExcel
Close Excel Workbook using VBA Macros
Tutorial: How to close an Excel workbook using VBA and macros, including how to save the file before...
Macro to get Data from Another Workbook in Excel
Tutorial: Macro to get data from a workbook, closed or open, over a network or locally on your comp...
Get User Submitted Data from a Prompt in Excel using VBA Macros
Tutorial: How to prompt a user for their input in Excel. There is a simple way to do this using VB...
Loop through a Range of Cells in Excel VBA/Macros
Tutorial: How to use VBA/Macros to iterate through each cell in a range, either a row, a column, or...
Join a Date and Time into a Single Cell using VBA Macros in Excel
Tutorial: In order to combine a cell that has a date with a cell that has a time, using a Macro and ...
Loop through All Worksheets in Excel using VBA and Macros
Tutorial: Ill show you how to loop through all of the worksheets in a workbook in Excel using VBA a...
Tutorial Details:
Downloadable Files: Excel File 1, Excel File 2
Similar Content
Close Excel Workbook using VBA Macros
Tutorial: How to close an Excel workbook using VBA and macros, including how to save the file before...
Macro to get Data from Another Workbook in Excel
Tutorial: Macro to get data from a workbook, closed or open, over a network or locally on your comp...
Get User Submitted Data from a Prompt in Excel using VBA Macros
Tutorial: How to prompt a user for their input in Excel. There is a simple way to do this using VB...
Excel Forum