+ Reply to Thread
Results 1 to 7 of 7

Getting "Method 'open' of object 'workbooks' failed" Error

  1. #1
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Getting "Method 'open' of object 'workbooks' failed" Error

    Hi All,

    I've got a portion of my code throwing up an error after I've made minor changes to it to check to see if the file is already open.

    Please Login or Register  to view this content.
    This seems to be having problems opening the file when the file does already exist in the specified location, but is not actually open. Any help would be appreciated.

    Thanks,
    ARowbot
    !If all your troubles are solved, then so is the thread. Show this by marking it so using thread tools at the top of the page.
    If I helped do this, then please show your appreciation by awarding rep points.
    <------ Button for that is over there

  2. #2
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Getting "Method 'open' of object 'workbooks' failed" Error

    UPDATE:

    It turns out for some reason the first time the code is run, the file it creates is damaged. Therefore I have put this code in:

    Please Login or Register  to view this content.
    However, is there anyway to check to see if the file is damaged first, as this throws up some unnecessary dialog boxes even when the file is fine.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: Getting "Method 'open' of object 'workbooks' failed" Error

    Hi Arowbot

    Any chance you can upload full code?
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Getting "Method 'open' of object 'workbooks' failed" Error

    You could try using Application.DisplayAlerts = False
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: Getting "Method 'open' of object 'workbooks' failed" Error

    Why not re save with different name after repair

  6. #6
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Getting "Method 'open' of object 'workbooks' failed" Error

    That has worked, thank you TMS. Sorry Sintek, I couldn't really upload the full code as it has multiple userforms etc and would take a while to remove all confidential data from the workbook. Thanks for all help.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Getting "Method 'open' of object 'workbooks' failed" Error

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] recorded macro "method opentext of object workbooks failed"
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2015, 10:04 PM
  2. Export Powerpivot to CSV - macro error "Method 'Open' of object '_Recordset' failed"
    By Phil McCready in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2015, 02:51 AM
  3. "Select method of worksheet class failed" w/ multiple workbooks open
    By Hester's Dad in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2010, 10:22 AM
  4. macro returns error "Method 'Open' of object '_Recordset' failed"
    By Leafgreen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-09-2009, 05:40 AM
  5. Error in Macro: "Method 'Paste' of object '_Worksheet' failed"
    By blork in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-05-2006, 01:50 PM
  6. [SOLVED] What is Error "Method "Paste" of object "_Worksheet" failed?
    By vat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-17-2006, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1