+ Reply to Thread
Results 1 to 3 of 3

Excel 10 crashes under Windows 10 after running VBA code

  1. #1
    Registered User
    Join Date
    12-02-2011
    Location
    Goodyear, AZ
    MS-Off Ver
    Excel 2010
    Posts
    26

    Excel 10 crashes under Windows 10 after running VBA code

    I have an Excel 10 SS which does financial modeling. The model has about a dozen tabs, two forms, and six VBA modules containing 5000+- lines of code making very heavy use of large arrays and writes many of these arrays to tabbed sheets. It also uses two external libraries, one a DLL for reading Metastock data files and the other a VBA module for reading Yahoo stock data.

    It ran perfectly under Windows 7. I've just switched to a new Win10 laptop on which I've installed Excel 10 and all Windows and Office 10 updates. When I first ran the model, Excel (not VBA) was crashing ("Microsoft Excel has stopped working ... Windows is checking for a solution to the problem") while executing the model. I was able to use breakpoints to identify fact it was crashing in a VBA chart formatting module. I reworked the line of code on which it was crashing and crashes in the chart formatting module ceased. The full model now runs to completion.

    However, when I change tabs, Excel crashes ("Microsoft Excel has stopped working ... Windows is checking for a solution to the problem"). This leads me to think that something during execution is destabilizing Excel without causing it to crash. I haven't a clue where to begin looking in my code for that issue. However, the code continues to execute flawlessly under Win7 so I suspect it is an Excel10/Win10 issue.

    I'm willing to upgrade to the new Excel 16 but I'm reading that some developers are finding it less than stable with VBA. I could move to Excel 13 but it precedes Win10.

    I'm looking for some guidance/ideas in solving the crashing problem. Thank you.

    Earl Adamy

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,575

    Re: Excel 10 crashes under Windows 10 after running VBA code

    Likely the DLLs are using 32bit API calls and Windows10 wants 64bit API calls. Try disabling the references one at a time and see if that stops the error.

    You might try disabling events to worksheet change events if that is what is firing the DLL calls. e.g. in the Immediate Window:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-02-2011
    Location
    Goodyear, AZ
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Excel 10 crashes under Windows 10 after running VBA code

    It turns out that the DLL was working fine and not affecting execution.

    I have identified the event which causes Excel to crash but not why. I have a series of tabbed sheets: Report, StatTbl, RunSum, Chart, Details, Presets, Funds, RiskModel, Performance.

    * If the Report tab is selected (active) before running the model, there is no crash, even upon selecting other tabs.

    * If one of the other tabs is selected (active) before running the model, Excel crashes immediately upon selecting another tab ... consistently. I even tried using code to switch to the Report tab before turning returning to normal mode (ScreenUpdating, Events, Calculation) and Excel still crashed on the Activate command.

    I have worked around the problem by adding "Worksheets("Report").Activate" after turning off ScreenUpdating, Events, and Calculation and prior to execution of the main code in the model. This works ... upon completing the model run, I can move around the tabs at will without Excel crashing.

    I don't like leaving the issue with a potential stability issue but I'm short on other options.

    Earl
    Last edited by eadamy; 12-31-2015 at 12:05 PM.

+ 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. Opening Excel File Crashes. Last opened in 2 windows. 2013
    By bowbalitic in forum Excel General
    Replies: 0
    Last Post: 10-03-2014, 12:08 AM
  2. Working Windows Excel File Crashes on Mac When Changing to one tab
    By bghbgh in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 10-08-2013, 03:36 AM
  3. File problems when running Windows VBA code on an Apple OS
    By jeh35 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2013, 04:10 AM
  4. VBA macro running in XP crashes in Windows 7
    By sadarudeen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2013, 01:08 PM
  5. Code works in Windows excel 2003 and 2010 but crashes in Mac excel 2011
    By kiweed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2012, 08:46 PM
  6. Excel sometimes crashes when running a sub routine
    By Brunstgnegg in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 08-20-2010, 06:55 AM
  7. Excel crashes after running Macro
    By sjl17 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2005, 06:27 AM

Tags for this Thread

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