数组可以用Ubound(),是测试这个数组的元素的个数,0即就是吧
文件可以用FileLen(),是测试文件的长度,0即是空吧空即是色,色即是空,
哈哈

解决方案 »

  1.   

    FileLen(pathname)必要的 pathname 参数是用来指定一个文件名的字符串表达式。pathname 可以包含目录或文件夹、以及驱动器。Dim MySize
    MySize = Filelen("TESTFILE.txt") ' 返回文件的字节长度
    if MySize=0 then print "文件为空"
      

  2.   

    参考Private a() As Variant
    Private Sub Command1_Click()
        
        MsgBox IsEmptyArray(a())
        
    End Sub
    Public Function IsEmptyArray(ByRef arr As Variant) As Boolean
        
        Dim o_vntArray As Variant
        
        On Error Resume Next
        
        If IsArray(arr) Then
            o_vntArray = arr(LBound(arr))
            IsEmptyArray = (Err <> 0)
        Else
            IsEmptyArray = False
        End If
        
    End Function
      

  3.   

    改进一下:Private m_vntArrayTest() As Variant
    Private Sub Command1_Click()
        
        MsgBox IsEmptyArray(m_vntArrayTest())
        
    End Sub
    Public Function IsEmptyArray(ByRef arr As Variant) As Boolean
        
        Dim o_vntArray As Variant
        
        On Error Resume Next
        
        If IsArray(arr) Then
            o_vntArray = arr(LBound(arr))
            IsEmptyArray = (Err.Number <> 0)
        Else
            IsEmptyArray = False
        End If
        
    End Function