+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 Workbook.Open crashes

  1. #1
    Registered User
    Join Date
    01-17-2014
    Location
    Hampton Roads, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Excel 2007 Workbook.Open crashes

    Hello all,
    This is my first time posting, but I'm in a real pickle. I'm pretty good with code in general and have learned VBA without much problem, but this one is stumping me. We have a workbook with VBA code to update it for a new year. When this code is run, it opens up 4 other excel files, reads data in, and closes them, in sequence. This file has been around and working for about two years, and was run to update as recently as this February without problems.

    Just yesterday, I opened it up, clicked the button, and after a little run time, it said "Microsoft Excel has stopped working" and tried to recover. After much messing around, I've found the problem is when it tries to open the last file, called "Weekly Plan.xlsx". Originally, it opened it with:
    Please Login or Register  to view this content.
    Thinking this might be the problem, I changed it to:
    Please Login or Register  to view this content.
    It didn't change anything. And, mind you, this is the fourth file to be opened this way, and I changed all of them. It consistently crashes on this one.

    I can open this file myself, manually, without any problems. The file has no code in it, and only two links, both to files that were previously opened in this code. However, the file does have an "Open in Read-Only" prompt. So, I saved a copy of it, titled "Copy of Weekly Plan.xlsx" without the prompt, and used it instead. It worked. The only problem is that Weekly Plan is updated by another system regularly, so I need that name. After messing around a little more, I made another copy of Weekly Plan titled "Weekly Plan2.xlsx", again without the prompt. It crashed. I removed the original file and renamed the Copy of to just "Weekly Plan.xlsx". It crashed. Back to Copy of and it works again.


    At this point, I'm about ready to beat my head against my computer until one or the other suffers a catestrophic failure. Can anyone help me understand this?

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,789

    Re: Excel 2007 Workbook.Open crashes

    What happens if you set the read only mode of that workbook explicitly to true while trying to open the workbook via code?

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    01-17-2014
    Location
    Hampton Roads, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Excel 2007 Workbook.Open crashes

    Setting the workbook to read-only still causes a crash, but it seems that if I set OpnFl to Nothing first, and then set it to the Weekly Planning workbook, it works. Does a workbook variable retain any information from previous opens if it get's written over without being reset to Nothing? And I'm still mystified as to why this suddenly became a problem after two years of no problems. I'm still a little gunshy, so I'll test it more before I consider this issue solved. Thanks.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,789

    Re: Excel 2007 Workbook.Open crashes

    Quote Originally Posted by cls36 View Post
    if I set OpnFl to Nothing first, and then set it to the Weekly Planning workbook, it works
    Yes when you use the same variable in loop then you have to reset it in the beginning or ending of each loop

  5. #5
    Registered User
    Join Date
    01-17-2014
    Location
    Hampton Roads, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Excel 2007 Workbook.Open crashes

    Thanks, that seems to have solved it.

+ 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. Replies: 3
    Last Post: 03-29-2013, 12:35 PM
  2. Help my excel crashes (I think on workbook open)
    By kamy333 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-26-2013, 03:26 PM
  3. Open excel 2010 workbook in excel 2007 missing references
    By Snoopy2003 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2011, 07:01 PM
  4. Macro to open Excel 2007 workbook - with macros enabled
    By CCL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2011, 06:39 AM
  5. Excel 2007 - can't open the workbook
    By orzel8 in forum Excel General
    Replies: 0
    Last Post: 01-11-2009, 04:19 AM

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