+ Reply to Thread
Results 1 to 8 of 8

Corrupt files> workbooks.open> excel crash

  1. #1
    Registered User
    Join Date
    05-28-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Corrupt files> workbooks.open> excel crash

    Hi Guys,

    First post here!

    I am new to VBA.
    I have a bunch of excel files from which I need to extract some data. All of these files have macros, activex controls, forms, pivot tables etc.
    Some of these files are corrupt. When I try to open these files manually (double click or File>Open), excel crashes.
    Same thing is happening when I try to open these files using workbooks.open command in VBA. So far I have tried following things:

    1. Application.EnableEvents = False
    Didn't work

    2. Workbooks.Open(filename,readonly:=true)
    Didn't work

    3. Disabled all macros and AciveX in "Trust Center"
    It worked, but I don't want end users to change these setting every time they need to run this macro.

    Is there any other way? If I could create a report of these corrupted files, it would be extra awesome

    Cheers!

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Corrupt files> workbooks.open> excel crash

    Hi,

    Have you attempted to specify the CorruptLoad argument when using Workbooks.Open?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Corrupt files> workbooks.open> excel crash

    Renaming the file before opening it has usually worked for me
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    05-28-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Re: Corrupt files> workbooks.open> excel crash

    Thank you for your responses.
    I tried all three options in CorruptLoad. Excel crashed each time.
    Same with renaming the file.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Corrupt files> workbooks.open> excel crash

    Have you tried using:
    Please Login or Register  to view this content.
    before opening the workbook with the corruptLoad parameter?

  6. #6
    Registered User
    Join Date
    05-28-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Re: Corrupt files> workbooks.open> excel crash

    Thank you xlnitwit!
    It worked. Didn't even need CorruptLoad.

    I suppose there would be no way to identify corrupt files?

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Corrupt files> workbooks.open> excel crash

    I do not personally know of one.

  8. #8
    Registered User
    Join Date
    07-26-2016
    Location
    Andorra
    MS-Off Ver
    2010
    Posts
    4

    Re: Corrupt files> workbooks.open> excel crash

    great! it's worked for me too.)

+ 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. Corrupt file. Fail to open using the workbooks.open method
    By Mortphi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2013, 01:48 AM
  2. workbooks.open keeps trying to open non-existing files
    By k.perry in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2011, 10:45 PM
  3. Corrupt files open and freeze... help!
    By Hambone70 in forum Excel General
    Replies: 2
    Last Post: 02-09-2011, 09:58 AM
  4. Attach all Open Workbooks to email as separate files?
    By nbaj2k in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2006, 09:30 AM
  5. Replies: 7
    Last Post: 04-15-2006, 04:20 PM
  6. corrupt Excel 2000/2002 files
    By Ohio Doug in forum Excel General
    Replies: 0
    Last Post: 11-21-2005, 11:40 AM
  7. Crash attempting to open Excel Add-in using .dll file comprised of VB6 code
    By Sirhc M in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-26-2005, 07:05 PM
  8. [SOLVED] How to open UTF-8 files with Workbooks.OpenText
    By Mete Kural in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-06-2005, 09:06 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