Expanding on David's reply, you can use either VarType(YourArray) or IsArray(YourArray). Unfortunately, neither of these will be of any help if you've declared your array as a specific type.
I've never had problems trapping the error that UBound generates, so I would suggest taking another look at your code and see if you're accidentally referring to your array "illegally" somewhere within the body of your error handling code or if you're referring to it before your On Error statement.
If all else fails, post your code and we'll all pick through it with a fine-tooth comb. :)
Rob
<david[ at ]epsomdotcomdotau> wrote in message news:uoIO9Nn0GHA.2196[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text] > If it's a variant, check the variant type first. > > (david) > > "Don Starnes" <DonStarnes[ at ]discussions.microsoft.com> wrote in message > news:798CCCBC-068D-486B-9422-581C5C4417EA[ at ]microsoft.com... >> I am trying to set values in a global, multidimensional array variables > when >> some forms open. The forms call a procedure in a module tests to see if > the >> arrays have values; if not, it Redims them and sets their values. The > values >> are used often throughout my application. >> >> I use Ubound(array, 1) to test if the array has values. If the array has > not >> been Redimmed and it's values haven't been set, Ubound gives a "subscript > out >> of range" error. I test for the error with On Error Goto mylabel; at > mylabel: >> there is code for filling the arrays. >> >> Often (but not always), the On Error fails to trap the error and throws > the >> error back to the procedure that called it, skipping the label and thus > not >> filling an array. >> >> The problem seems to be how to test for values in an array (I've searched >> this forum and everyone seems to use Ubound). >> >> Is there a better way to do this? This must be a common need and a common >> problem, but I haven't been able to find the answer. >> >> Thanks! >> Don >> > >
|