How to Open a Closed Workbook in Excel?


Excel is an effective application that enables both individuals and businesses to easily manage and analyse data. The majority of us are comfortable creating and updating workbooks in Excel, but what happens when you need to retrieve a closed workbook that you've already saved? It may appear difficult to open a closed worksheet, especially if you're unfamiliar with Excel or haven't used this feature before. However, do not worry! In this lesson, we'll walk you through each step of opening a closed workbook in Excel so you have the knowledge and abilities to quickly access your crucial data and discover new opportunities.

Regardless of your level of expertise, you will have a firm understanding of the methods needed to open closed workbooks in Excel by the end of this guide. This lesson will meet your needs whether you're a beginning, intermediate, or advanced user by giving you clear instructions and examples to make learning easy.

Open a Closed Workbook

Here we will first insert a VAB module and then run it to complete the task. So let us see a simple process to learn how you can open a closed workbook in Excel.

Step 1

Consider any Excel workbook.

First, right-click on the sheet name and select View code to open the VBA application.

Right click > View Code.

Step 2

Then click on Insert, select Module, and copy the below code into the text box.

Insert > Module > Copy.

Code

Sub OpenClosedWorkbook()
   Dim xWb As Workbook
   Dim wbName As String
   On Error Resume Next
   Set xWb = Workbooks.Open(""C:\Users
i31a\OneDrive\Desktop\Open.xlsx"") wbName = xWb.Name If Err.Number <> 0 Then MsgBox "This workbook does not exist", vbInformation, "Open Closed Workbook" Err.Clear Else MsgBox "The workbook is opened", vbInformation, "Open Closed Workbook" End If End Sub

In the code F:
ew\add.xlsx is the path to the file.

Step 3

Then save the sheet as a macro-enabled template and click F5 to open the workbook.

Save > F5.

If there is any error in the file path or the file does not exit, a message will be displayed.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can open a closed workbook in Excel to highlight a particular set of data.

Updated on: 06-Sep-2023

111 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements