Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2002
    Location
    California
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2000 crashes with 97 file (2000 SR1)

    I have three files created from the same template in Excel 97. The files are stand-alone, i.e., there are no external links or database queries. One of them has no problem. When the other two are opened in Excel 2000 (on Windows 2000, tried on multiple PCs) with macros enabled, Excel reports circular references that can't be displayed. A number of cells show #NAME?, some of which go away if I select the cell and hit Enter; others remain, and yet their formulae use the same references as adjacent cells that calculate correctly. If I recalculate, Excel crashes, leaving a bunch of .emf files in the Temp directory; the event log says there was an access violation.

    Any suggestions on what might be going on? The files still work fine in 97, and one of them is OK in 2000.

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 2000 crashes with 97 file (2000 SR1)

    Sounds like there might be something buggy with the code. Try exporting the code module(s) and then removing it/them from the files. Load the "cleaned" files into a problem configuration. Import the module(s). Then step through the code from Tools|Macros|Macros. Hopefully, this should isolate where the problems kick in. HTH
    Gre

  3. #3
    New Lounger
    Join Date
    May 2002
    Location
    California
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 2000 crashes with 97 file (2000 SR1)

    Thanks for the suggestion. I was able to isolate which function is having a problem, but I don't think the problem is a bug - the code has worked for years and still works in one of the files. Stepping through the function reveals VBA not performing an assignment and then stopping for no reason. Here's the code:

    Function dblARExposure(ByVal vbytMn1 As Byte, ByVal vbytMnCnt As Byte) As Double
    Attribute dblARExposure.VB_ProcData.VB_Invoke_Func = " n14"

    Dim Appfunc As Object
    Dim bytARMns As Byte
    Dim wksComp As Worksheet
    Dim dblExposure As Double
    Dim iMn As Byte

    Application.Volatile
    bytARMns = 3
    dblARExposure = 0
    If vbytMnCnt >= bytARMns Then
    Set wksComp = ThisWorkbook.Worksheets("Components")
    If Left(Application.Version, 1) > "7" Then
    Set Appfunc = Application.WorksheetFunction
    Else
    Set Appfunc = Application
    End If

    For iMn = vbytMn1 To vbytMn1 + vbytMnCnt - bytARMns
    dblExposure = Appfunc.Sum(wksComp.Range("Revenue").Offset(0, iMn). _
    Resize(1, bytARMns)) '<-- Sum is calculated correctly but VBA does not assign it to dblExposure
    If dblExposure > dblARExposure Then _
    dblARExposure = dblExposure '<-- VBA stops on second iteration for no reason
    Next iMn
    End If

    End Function

    Any ideas what VBA is up to?

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 2000 crashes with 97 file (2000 SR1)

    What springs to mind is that you might have a missing reference? In my setup, the Attribute keyword as such is not recognized by Help, so I guess it is a keyword from another object model than the ones I have checked usually. Maybe it has something to do with that?

    As a side remark, I tend to pass all information a function need through it's argument list as opposed to using range references inside the function. If the range contains constants, I prefer having them inside the function itself as defined constants.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    New Lounger
    Join Date
    May 2002
    Location
    California
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 2000 crashes with 97 file (2000 SR1)

    The line with Attribute only appears when I export the module; when I reimported the module, it does not appear. So, I have no idea where it came from, what it means, or why it appears and disappears; but I didn't write it myself. Is it a clue or a red herring? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

Posting Permissions

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