Open an Excel workbook
How to open a single workbook using Excel, VBA and Shortcut methods
1. Select the File tab. |
2. Click Open. 3. Click ThisPC and select the location of the workbook. 4. Select the workbook to open it. Note: in this example we are opening a workbook titled Examples.xlsx which is located in C:\Excel\. |
METHOD 1. Open an Excel workbook using VBA by directly referencing the file path and workbook name
VBA
Workbooks.Open "C:\Excel\Examples.xlsx"
End Sub
Workbook location: Have a workbook that you are referencing to in the VBA code on your device in the C:\Excel\ path.
Workbook Name: Have a workbook named Examples.xlsx, in the location specified in the VBA code.
Workbook location: Select the file path of the workbook that you want to open by changing the C:\Excel\ path.
Workbook Selection: Select the workbook that you want to open by changing the Examples.xlsx workbook name in the VBA code to any workbook that is located in the path provided in the VBA code.
Dim wbfilepath As Variant
wbfilepath
End Sub
Worksheet Name: Have a worksheet named Parameters.
Workbook location and Name: Cell A1 in the Parameters worksheet needs to capture the file path, workbook's name and file type (e.g. C:\Excel\Examples.xlsx) of the workbook that you want to open.
Cell Reference: Select the cell that captures the file path, workbook's name and file type of the workbook that you want to open by changing the cell reference in the VBA code. You can also change the worksheet's name ("Parameters") if the cell is located in another worksheet.
Note 1: To select the workbook that you want to open you will need to insert the file path, workbook's name and file type in the cell that is referenced in the VBA code. In this example we are capturing the file details in cell A1 in the Parameters worksheet, therefore, if using the same VBA code you will need to insert the file path, workbook's name and the file type in that cell.
METHOD 3. Open an Excel workbook using VBA with a Browser
VBA
Dim browser As Variant
browser = Application.GetOpenFilename(filefilter:="ExcelFiles,*.xl*;*.xm*")
End If
End Sub
Note 1: This method will open a browser where you can select the Excel workbook that you want to open. This VBA code has also setup the parameters for only Excel workbooks to appear visible in the browser.
NOTES
This shortcut will instantly take you Step 2 of Excel-Method 1, which takes you to the Open screen. You can then follow Steps 3 and 4 from the Excel-Method 1 to open a workbook, which is click on ThisPC and select the location of the workbook and then select the workbook that you want to open.
This tutorial explains and provides step by step instructions on how to open a workbook using Excel, VBA and Shortcut methods.
Excel Method: This tutorial provides one Excel method that can be applied to open an Excel workbook. This method opens an Excel workbook through an existing workbook, in four steps.
VBA Methods: This tutorial provides three VBA methods that can be applied to open an Excel workbook. Using the first VBA method, you need to include the file path and name directly in the VBA code. The second VBA method is more dynamic, which references to a cell in an Excel workbook that captures the file path and name of the Excel workbook that you want to open. The third method will let you select the Excel workbook that you want to open through a browser.
Shortcut Method: The shortcut method in this example will take you to the Open window from which you can browser and select the Excel workbook that you want to open.
Related Topic | Description | Related Topic and Description |
---|---|---|
Open an Excel workbook that was recently used | How to open a workbook that was recently used and closed using Excel and Shortcut methods | |
Open an Excel workbook as Read-Only | How to open a single workbook as Read-Only using Excel and VBA methods | |
Open an Excel workbook in Protected View | How to open a single workbook in Protected View using Excel and VBA methods | |
Close an Excel workbook | How to close a single workbook using Excel, VBA and Shortcut methods | |
Save an Excel workbook | How to save a workbook using Excel, VBA and Shortcut methods |