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)
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?
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)
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?)
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.
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:
Public Function getSerialNumber() As Long
'Gets the storage medium's serial number
Dim SerialNumber As Long
Dim VName As String
Dim FSName As String
On Error GoTo Method2
VName = String(255, Chr$(0))
FSName = String$(255, Chr$(0))
GetVolumeInformation Left(ThisWorkbook.Path, 3), VName, 255, SerialNumber, 0, 0, FSName, 255
getSerialNumber = Abs(SerialNumber)
Exit Function
'error 429
Method2:
Dim FileSystemObject As Variant
Dim D As Variant
'fso method requires wshom.ocx activeX component to work - missing on some win98 systems
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set D = FileSystemObject.GetDrive(Left(ThisWorkbook.Path, 2))
SerialNumber = Abs(D.SerialNumber)
getSerialNumber = Abs(SerialNumber)
End Function
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.