J
Johan Verdouw
I am using Word 97 with Windows 98. On initializing a user form I want
to fill a listbox with values from an array. The array is filled in
another procedure. When the array contains no elements however, the
listbox should not be shown. Right now my code is like this:
Sub Initialize_Userform()
On Error Goto Err_Handler
(...)
lboListbox1.List = Array1
(...)
Err_Handler:
If Err.Number=380 then
'Code not to show listbox
End If
End Sub
Error 380 occurs when you try to populate a listbox with an empty
array. Is there another way to determine if an array contains no
elements? I know I can use UBound() and LBound() to determine upper
and lower boundary, but that function also generates an error if there
is no element in the array.
I have searched this newsgroup, but I could not find an answer to my
question. Hope somebody can help.
Regards,
Johan Verdouw
Trainer / Microsoft Office Specialist
to fill a listbox with values from an array. The array is filled in
another procedure. When the array contains no elements however, the
listbox should not be shown. Right now my code is like this:
Sub Initialize_Userform()
On Error Goto Err_Handler
(...)
lboListbox1.List = Array1
(...)
Err_Handler:
If Err.Number=380 then
'Code not to show listbox
End If
End Sub
Error 380 occurs when you try to populate a listbox with an empty
array. Is there another way to determine if an array contains no
elements? I know I can use UBound() and LBound() to determine upper
and lower boundary, but that function also generates an error if there
is no element in the array.
I have searched this newsgroup, but I could not find an answer to my
question. Hope somebody can help.
Regards,
Johan Verdouw
Trainer / Microsoft Office Specialist