做一个函数:
Private Function CLUbound() As Integer ' 判断数组赋值
On Error GoTo myError CLUbound = UBound(RT) 'RT为一动态数组名
Exit FunctionmyError:
CLUbound = -1 '未赋值
End Function
Private Function CLUbound() As Integer ' 判断数组赋值
On Error GoTo myError CLUbound = UBound(RT) 'RT为一动态数组名
Exit FunctionmyError:
CLUbound = -1 '未赋值
End Function
Dim flag As Boolean
Private Sub Command1_Click()
flag = True
If flag Then
ReDim a(4) As String
MsgBox UBound(a)
End If利用flag的值,这样ok吗?