Excel VBA runtime error 1004:method ‘’ of object ‘workbooks’ failed

Turk182

Board Regular
Joined
Sep 9, 2009
Messages
66
Office Version
  1. 365
Platform
  1. MacOS
Hi, does anyone have an idea regarding a possible “fix” for this error?
--Excel VBA runtime error 1004: method ‘’ of object ‘workbooks’ failed
the file to open is not currently open, nor is it being used by someone else
I appreciate any help. Thx.
...


VBA Code:
FileToOpen = Application.GetOpenFilename(Title:="Browse for the SUPPLIER File you saved & SELECT it", ButtonText:="Choose SUPPLIER Dec Sheet")

   If FileToOpen <> False Then
       Set OpenBook = Application.Workbooks.Open(FileToOpen)
...
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
1. Is there a limit on the number of (or "level" of) "nested" folders-within-folders that this code can access to open?… I moved FILE TO BE OPENED to a "parent" folder and it worked!
2. Is there a way to tell whether the folder itself is corrupted?

It is strange--to me-- that just putting the files in the “parent” folder resolved the issue.
Just to test, I put the files back in the “sub folder”, ran the macro, and I got the same error message again!
:confused2:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top