Thanks dmaruca and anhn. I guess this issue is resolved now. I did modify dmaruca's function a little and included it and a test routine below.
One can actually find out where the source of the error by looking in the Locals window at the various processes in the dropdown tool at the right of the Process name edit box. There will be a green arrow at the instruction that called the function.
'20080620.1116 Arthur Du Rea (c) Copyright 2008 All rights reserved
'Based on work by "dmaruca", "anhn", and others. http://www.vbforums.com/showthread.php?t=528009
'Test an Array as a Parameter to see if it is Initialized
' Returns TRUE if the UBound of the Array is Greater than or Equal to Zero (Array IS initialized)
' Returns FALSE if the Array has never been dimensioned (Redim) - reading UBound generates Error
'Passes any other problem or error (eg. Parameter is NOT an array) to the System Error Reporter
'The only drawback to this function is that if there is an error OTHER than an array initialization
' problem, the debugger will ALWAYS point to the "Err.Raise" line at the end of this function,
' because that is where the "Error" is actually sent to the System.
Function IsInitializedArray(ByRef anArray) As Boolean
'Trap the system error exception where the Array is NOT initialized
On Error GoTo ErrorProc
'Check to see if the Array has a valid Upper Bound (i.e. It IS initialized)
If UBound(anArray) >= 0 Then IsInitializedArray = True
'Reset the Error Exception Handler to the SYSTEM error handler
On Error GoTo 0
'Go Back to the Calling process
'UBound(anArray) Error Exception Handler
'System Error #9 means that there are no available subscripts for this array (NOT initialized)
If Err.Number = 9 Then
'Report that the Array Parameter is NOT Initialized and do a normal continuation
IsInitializedArray = False: On Error GoTo 0: Exit Function
'Debug.Print Err.Number, Err.Source, Err.Description
'Pass the UNKNOWN Error Parameters to the System Error Reporter
'object.Raise number, source, description, helpfile, helpcontext
Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile, Err.HelpContext
'TEST the Function ...
Dim myArray() As Integer 'An Array to TEST
Dim tStr As String 'A String is 'an array of characters'?
'Check to see if the Array "myArray" has ever been initialized
If IsInitializedArray(myArray) Then
Debug.Print """myArray"" IS Initialized"
Debug.Print """myArray"" is NOT initialized"
tStr = "TEST"
'tStr is NOT an array ... it will correctly pop up a system error report
'but the debugger will end up in the "IsInitializedArray" function.
If IsInitializedArray(tStr) Then Debug.Print "tStr is Initialized"
Thanks again ... you guys are GREAT!