PDA

View Full Version : Error Message, Warning Message: List/Database



YellowLabPro
08-12-2007, 04:41 AM
I have inquired about a reference regarding VBA Error Messages, on several prior occassions. I have yet to find one, nor anyone who knew of any, so it might be a good time to start one. If in fact this is the case, that none do exist, I would like to create one and contribute it to VBAx.

I would like to publish the following information, Error Message Title, Error Message, the current method where this occurred, resolution required, an example if possible, and contributor's user name,(anonymous if you prefer not to be credited for the submission), date of submission (w/ different date formats, please use the long text version), and any pertient comments that will help the user understand better.
If possible Please: Contributions should be reproduced exactly as shown, Upper/Lower case structure, punctuation, etc...

If there are other details that might be useful please feel free to comment on this.

Example of Contribution:
Error Message Title: ....Compile error:
Error Message: ...........Next without For
Method: ....................For...Next Loop
Resolution: ................Unpaired End If, additonal End If added
Contributor: ...............YellowLabPro
Date: .......................June 12, 2007
Comments:.................Next without For message immediately conjures the notion to look at the loop constructs, where in this case, the ommission of the matching End If prevents the loop from closing, wherein the matching End If is required, not a missing Next.

Example:
Problem Code:

Option Explicit
Sub Test()
Dim cel As Range
For Each cel In Cells.UsedRange
If cel = "" Then
cel.Interior.ColorIndex = 6

Next
End Sub



Resolution:
Option Explicit
Sub Test()
Dim cel As Range
For Each cel In Cells.UsedRange
If cel = "" Then
cel.Interior.ColorIndex = 6

------------------------------
'Missing End If Below
------------------------------
End If
Next
End Sub
Contributions can be either posted to this thread or emailed directly to me at, DougPoBox@aol.com

Thanks for everyone's contributions in advance.

Doug
aka "YLP"

mdmackillop
08-12-2007, 05:08 AM
In this example, there is a secondary reason, which may not be as obvious and should be included.
Example of Contribution:
Error Message Title: ....Compile error:
Error Message: ...........Next without For
Method: ....................For...Next Loop
Other causes: ............Unpaired If/End If
Resolution: ................Additional End If added
Contributor: ...............YellowLabPro
Date: .......................June 12, 2007

mdmackillop
08-12-2007, 05:15 AM
For a list
Sub ErrList()
Dim i
For i = 1 To 750
Cells(i, 1) = i
Cells(i, 2) = Error(i)
Next
End Sub

Bob Phillips
08-12-2007, 05:33 AM
Why stop at 100? Most after 100 are Application/object errrors, but there are others. This also shows the big problem, several error messages have a myriad of causes.

mdmackillop
08-12-2007, 05:45 AM
Changed to 750.

Cyberdude
08-25-2007, 11:51 AM
Great idea! Why not take this a step farther and create a sub-forum called "Excel Error Message Help"?

mdmackillop
08-26-2007, 02:05 AM
Example of Contribution:
Error Message Title: ....Compile error:
Error Message: ...........Object variable or With block variable not set
Method: ....................Multiple
Other causes: ............Missing reference
Resolution: ................Check for missing references; remove check mark
Contributor: ...............MD
Date: .......................August 26, 2007

malik641
08-28-2007, 09:16 AM
Shouldn't we add the Error number too?


This also shows the big problem, several error messages have a myriad of causes.
It would be nice to have a collection of typical errors that have the same number associated with them.

YellowLabPro
08-28-2007, 10:20 AM
Joseph - Good Point,
Yes if the error received has a numerical value then include it w/ the submission and I will add it to the table.

Thanks,

Doug

Bob Phillips
08-28-2007, 11:17 AM
Shouldn't we add the Error number too?


It would be nice to have a collection of typical errors that have the same number associated with them.


I was talking more of the fact that many errors have different numbers, but the same description, presumably because it is a different underlying cause.

malik641
08-28-2007, 11:33 AM
Oh. My bad.

But I still think we should add the error number to these entries.

mdmackillop
03-28-2008, 05:59 PM
No postings here for months, so I'm unsticking this thread.