Results 1 to 7 of 7

Thread: Excel Troubles - Mind Boggling

  1. #1

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    Excel Troubles - Mind Boggling

    Alright, I have a slight problem.

    Well actually it's more of a massive problem.

    You see, I have code which fails on 'some' computers, but not 'other' computers. It also seems that it can go from not working to working, and vice versa. It seems that when a certain form is run (sometimes) excel crashes (no error message, just dies)

    In any case, I went to where it wasn't working, and tried to narrow down where the problem was. I found out the problem is on this line:

    if checkboxname.value = true then

    Ignoring the fact that " = true" shouldn't be there, and that the checkbox obviously doesn't have that name, WHAT IS GOING ON?! I comment out the line and Excel goes down on a different line (I didn't spend the time to comment them all out)

    I've run into this kind of thing before. Usually, exporting/importing the form or cutting/pasting the controls or even commenting/uncomment the code will make it 'go away'... but I can't seem to fix this one!

    This software is going to Ontario within the week, and I want to have a patch ready to fix this problem (we've already released in Atlantic Canada)
    Don't pay attention to this signature, it's contradictory.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel Troubles - Mind Boggling

    What version(s)? The True is optional and is ok if its there. Could it be that if you cut and paste the contol your may be
    using a different versons of the control on different versions of Excel?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    Re: Excel Troubles - Mind Boggling

    Quote Originally Posted by RobDog888
    What version(s)? The True is optional and is ok if its there. Could it be that if you cut and paste the contol your may be
    using a different versons of the control on different versions of Excel?
    We test on 97 and 2003. I don't know if the problem only exists in 97 or not, but I do know that people using the same file can have the problem or not have the problem. (The file is NOT saved or modified during execution)
    Don't pay attention to this signature, it's contradictory.

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Excel Troubles - Mind Boggling

    Might be a memory problem. API calls can crash it for no reason, and if the variables aren't cleaned up right, it can cause a crash too.

    Otherwise, try exporting all modules as text files, and any forms too. Create a new spreadsheet and reimport all those text files.

    Also you may want to check as you import as whether it is dying (if you can) as it may only one particular module/code that is causing the problem (corruption perhaps?)

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel Troubles - Mind Boggling

    Correct Vince. Which APIs are your using Alkatran? CopyMemory is usually an API that will crash your program if not used properly.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    Re: Excel Troubles - Mind Boggling

    There are no API calls being used on the form. I believe that the only API call used in the program is GetVolumeInformation, which we use to get the drive's serial number (which we use as a seed for activation keys so people can't easily 'copy' the software from a friend)

    It is conceivable that this would be called BEFORE the form starts, but that wouldn't explain why only this form seems to be affected. (the API is called almost anytime they leave the main screen or start the program)

    Here is our code for the serial number:

    VB Code:
    1. Public Function getSerialNumber() As Long
    2. 'Gets the storage medium's serial number
    3. Dim SerialNumber As Long
    4. Dim VName As String
    5. Dim FSName As String
    6. On Error GoTo Method2
    7.    
    8.     VName = String(255, Chr$(0))
    9.     FSName = String$(255, Chr$(0))
    10.     GetVolumeInformation Left(ThisWorkbook.Path, 3), VName, 255, SerialNumber, 0, 0, FSName, 255
    11.     getSerialNumber = Abs(SerialNumber)
    12. Exit Function
    13.  
    14. 'error 429
    15. Method2:
    16. Dim FileSystemObject As Variant
    17. Dim D As Variant
    18.     'fso method requires wshom.ocx activeX component to work - missing on some win98 systems
    19.     Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
    20.     Set D = FileSystemObject.GetDrive(Left(ThisWorkbook.Path, 2))
    21.     SerialNumber = Abs(D.SerialNumber)
    22.     getSerialNumber = Abs(SerialNumber)
    23. End Function
    Don't pay attention to this signature, it's contradictory.

  7. #7
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Excel Troubles - Mind Boggling

    I have a similar problem. It turned out to be the use of Left.
    If I rem that line out the app runs fine!

    It would appear that some pc platforms that dont have the latest librarys have this problem.


    Bruce.

Posting Permissions

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



Click Here to Expand Forum to Full Width