[Fixed!] Method Open of Object Workbooks Failed (4 Solutions)

Solution 1 – Use GetOpenFilename Method

To solve the problem of “method open of object workbooks failed”, you need to use VBA. Microsoft Visual Basic for Applications (VBA) is Microsoft’s Event Driven Programming Language. To use this feature you first need to have the Developer tab showing on your ribbon. Click here to see how you can show the Developer tab on your ribbon.

Steps:

  • VBA has its own separate window to work with. You have to insert the code in this window. To open the VBA window, go to the Developer tab on your ribbon. Select Visual Basic from the Code

using VBA code to solve “Method Open of Object Workbooks Failed” Error

  • VBA modules hold the code in the Visual Basic Editor. It has a .bcf file extension. We can create or edit one through the VBA editor window. To insert a module for the code, go to the Insert tab on the VBA editor. Click on Module from the drop-down.

inserting module

  • A new module will be created.
  • Select the module.Enter the following code.
Sub Opening_Workbook ()
    Dim strrFile As String
    strrFile = Application.GetOpenFilename()
    Workbooks.Open (strrFile)
End Sub
  • Save the code.
  • Click on Run.

  • A Open window will appear.
  • Choose the workbook which you want to open.
  • Click OK.

 

Read More: VBA Object Variable or with Block Variable Not Set in Excel


Solution 2 – Apply Correct File Path While Opening Workbook

Steps:

  • Go to the Developer tab on your ribbon. Select Visual Basic from the Code group.

apply VBA code to solve “Method Open of Object Workbooks Failed” Error

  • Go to the Insert tab on the VBA editor. Click on Module from the drop-down.

  • A new module will be created.
  • Select and enter the following code.
 Sub Macro_2()
   Workbooks.Open Filename:="C:\Users\USER\Desktop\saquib\61-0081\How to Forecast Cash Flow in Excel.xlsx"
End Sub
  • Save the code.
  • Click on Run.

run VBA code

 

Note:

Sometimes, when the above code is not working to solve the problem, the Approve-It add-in may be the main issue in some cases. Disable it from your system.

In some cases, the Foxit reader add-in was causing the problem. Remove it.

Read More: [Fixed!] Subscript Out of Range Error in Excel VBA


Solution 3 – Make Sure File Is Not Corrupted

Occasionally, a corrupted file will cause the error “method open of object workbooks failed” when opening a file in read-only mode. As a result, Excel would give an error since it can only fix corrupt files by writing to them and repair files only if they are allowed to be opened. A corrupt file cannot be repaired in read-only mode, so if you try to open it in this mode, it will not open. A corruption occurred because the sources for the dropdown list on another spreadsheet were not copied.

To solve this problem, open the input file manually and resave it and change the function name.

Read More: Reasons And Solutions for Excel Object Required Error in VBA


Solution 4 – Avoid Running Excel on Net.App Application

This problem may occur because of MS Excel running on the Net.App application where VBA wasn’t installed accurately.

  • Go to Control Panel and select Program and Features and uninstall this program.
  • Find the installed office, right-click and choose Change.

Read More: [Fixed!] Excel Application-Defined or Object-Defined Error in VBA


Download Practice Workbook


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Saquib Ahmad Shuvo
Saquib Ahmad Shuvo

Saquib Ahmad Bhuiyan, holding a BSc degree in Naval Architecture & Marine Engineering from Bangladesh University of Engineering and Technology, skillfully integrates engineering expertise with a passion for Excel. He provides solutions to complex issues as an Excel & VBA Content Developer for ExcelDemy Forum. He demonstrates an enthusiastic mindset and adeptness in managing critical situations with finesse, showcasing his commitment to excellence. Apart from creating Excel tutorials, he is interested in Data Analysis with MS Excel, Rhinoceros,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo