+ Reply to Thread
Results 1 to 13 of 13

Excel files crashing when upgrading to 64bit Excel

  1. #1
    Registered User
    Join Date
    04-07-2014
    Location
    n/a
    MS-Off Ver
    Excel 2010
    Posts
    13

    Excel files crashing when upgrading to 64bit Excel

    I have a bunch of Excel files heavy with VBA code. This Excel were created by a programmer in Excel 2010 32bit. When we upgraded to Excel 2013 64 bit in our company, these Excel files began to generate problems: we were able to fix declarations and use those files, however in repeated instances these file began to crash when enabling the macro content. Files without VBA content never crash.

    I have found a workaround:

    1. Open the workbook in Excel. Normally Excel will disable macros in a worksheet until you click a button to enable the macros. Do not enable the macros just yet.
    2. Open the VBA editor. You can hit ALT+F11 or on the ribbon click Developer > Visual Basic
    3. In the VBA editor double click your module or first module that contains your project. Add a commented line of code such as:

    ‘ This is a comment

    Then click on the Debug menu at the top and click Compile VBA Project.

    Repeat this step for each module in your workbook and then save the workbook.

    4. Close the workbook and re-open it and enable the macros and test it.

    However, some of the files that were recompiled keep crashing.

    My question is:
    -is there a viable and stable solution?
    -what is in fact the source of the problem?

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Excel files crashing when upgrading to 64bit Excel

    Excel 64 bit, will crash frequently on PCs with 32bit OS.
    Excel 32 bit, will crash frequently on PCs with 64bit OS.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Excel files crashing when upgrading to 64bit Excel

    Quote Originally Posted by ranman256 View Post
    Excel 64 bit, will crash frequently on PCs with 32bit OS.
    Excel 32 bit, will crash frequently on PCs with 64bit OS.
    I disagree. 64bit Excel won't install or work on 32 bit Windows at all. I have used 32bit Excel on 64bit Windows for several years without frequent crashes.
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Excel files crashing when upgrading to 64bit Excel


    Hi !

    I agree with romperstomper, I use different Excel 32 bits version on 64 bits OS (Seven or Windows 8) and no crash issue …

    And since 2010 version, Microsoft itself advises to install in 32bits !

    In 64 bits, many codes are to be modified if they use Declare statement for API (search for PtrSafe mod).
    But some APIs do not exist in 64 bits versions or give issues …

  5. #5
    Registered User
    Join Date
    04-07-2014
    Location
    n/a
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel files crashing when upgrading to 64bit Excel

    Just to clarify, OS is 64bit. Files were originally generated in OS 32bit / Excel 2010 32bit enviromnment, they crash now that we are in OS 64bit/Excel 2013 Environment.

    Also, all declare statements have been modified (Ptr to PtrSafe).

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Excel files crashing when upgrading to 64bit Excel

    Was that all you changed in the Declares? You usually need to do more - some Longs need to be LongPtr or even LongLong.

  7. #7
    Registered User
    Join Date
    04-07-2014
    Location
    n/a
    MS-Off Ver
    Excel 2010
    Posts
    13
    Quote Originally Posted by romperstomper View Post
    Was that all you changed in the Declares? You usually need to do more - some Longs need to be LongPtr or even LongLong.
    i will verify that. Ptr to PtrSafe for sure. However, would that cause the excel file to crash or rather would it just be that the Excel cant be used (as it was before I changed the declarations Ptr to PtrSafe)?

  8. #8
    Registered User
    Join Date
    04-07-2014
    Location
    n/a
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel files crashing when upgrading to 64bit Excel

    These are the declarations:

    Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare PtrSafe Function CloseClipboard Lib "user32" () As Long
    Private Declare PtrSafe Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
    Private Declare PtrSafe Function EmptyClipboard Lib "user32" () As Long

    'CreateMetaFileA DeleteEnhMetaFile
    Private Declare PtrSafe Function CopyEnhMetaFileA Lib "gdi32" (ByVal hENHSrc As Long, ByVal lpszFile As String) As Long
    Private Declare PtrSafe Function DeleteEnhMetaFile Lib "gdi32" (ByVal hemf As Long) As Long

    Right, there is not only PtrSafe but also Long. That said, again, would that be an issue that results in a crash of the Excel file or rather something that simply will not allow me to open this Excel file?

  9. #9
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: Excel files crashing when upgrading to 64bit Excel

    Hi Aciccarelli;

    Actually, the problem may not be with your code at all! Office 2013 actually doesn't install with VBA support by the default install options. If you head to your installed programs on your control panel, right click on excel, there should be an option to enable VBA support.
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  10. #10
    Registered User
    Join Date
    04-07-2014
    Location
    n/a
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel files crashing when upgrading to 64bit Excel

    Miraun,

    thank you for very much for your reply. I am also quite convinced that it is not the code.

    Having said that, if I enable VBA support, that would mean that I receive automatic updates to fix compatibility (or does it simply mean that I can escalate this to MS and they can provide me an answer)? Sorry the stupid question, but I am total noob

  11. #11
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Excel files crashing when upgrading to 64bit Excel

    Hi accicarelli,

    I agree with what the previous posters have to say. Upgrading from 32 bit Excel to 64 bit Excel is not trivial, especially if VBA is involved. Issues you have to be concerned with include:

    a. API function declarations and usage. For example your OpenClipboard declaration in post #8 is probably incorrect. You have:
    Please Login or Register  to view this content.

    The Microsoft master file contains:
    Please Login or Register  to view this content.
    b. Some items that were provided in previous versions of Excel are no longer available in 64 bit Excel such as the DatePicker that was previously available in file mscomct2.ocx.

    c. You may have problems with 'Active X' controls created in 32 bit Excel.

    d. ...and there is more that nobody knows about yet.

    Lewis

  12. #12
    Registered User
    Join Date
    04-07-2014
    Location
    n/a
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel files crashing when upgrading to 64bit Excel

    I have tried the solution described here:

    http://blogs.technet.com/b/the_micro...ing-macro.aspx

    and it seems to work for a while, but then the same file--which had worked for a while--go back to crashing.

    Could you please provide link where I can find correct declarations? Thank you for pointing out the mistake in the code I provided

    Also, if I were to provide a code to a "VBA wizard" would that person be able to fix the issue looking at the code (and the file), or is this something that has been difficult to grasp also for VBA Excel experts? Seems to me, having searched online for almost a year, that this issue is creating difficulties to a lot of persons.

    Thanks for help

  13. #13
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Excel files crashing when upgrading to 64bit Excel

    See https://www.microsoft.com/en-us/down...s.aspx?id=9970

    If you have problems downloading the file, this isn't the official site, but the file (Win32API_PtrSafe.TXT) seems to be the same as the file I downloaded from Microsoft. The Microsoft site is very cryptic as to what you need to do to download the file. http://www.cadsharp.com/docs/Win32API_PtrSafe.txt

    I don't have access to 64 bit Excel.
    Last edited by LJMetzger; 07-25-2015 at 04:26 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. Excel crashing when trying to view code before macro run; not crashing after first run
    By goonerforlyf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2015, 05:27 PM
  2. How to read custom props on closed file (64bit Win Server, 64bit Excel)
    By soundneedle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2015, 01:25 AM
  3. Excel crashing while working with several excel files
    By ej7777 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 02-17-2014, 04:47 AM
  4. Change registry settings for IE 64bit in 64bit environment
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2014, 07:56 AM
  5. Replies: 0
    Last Post: 12-09-2012, 10:43 AM
  6. Replies: 3
    Last Post: 11-23-2012, 01:57 AM
  7. Excel crashing when working with large files
    By theradpotato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2010, 01:40 PM

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