Public strDatas(99) As StringIf Len(strDatas(index)) < 15 Then
        getData = ""
        Exit Function
End If这段代码写在一个模块的一个方法中,但是运行到这里的时候总是报错
是类型不匹配的错误,我看了半天不知道怎么回事,而且把这段代码拿到其他工程里就没问题
但是在这个工程里只要一用到strDatas(index)) 就出类型不匹配的错误,包括Debug.pring打印的时候,内容是打印出来了,但是就在Debug打印的这一行中还是会报这个错误谁遇到过类似的?帮忙解释

解决方案 »

  1.   

    你的INDEX变量是哪里来的?自己定义的还是什么?
      

  2.   

    index这个变量的定义和值是什么呢?
      

  3.   


    getData 函数返回值是什么类型?
      

  4.   


       If IsNumeric(Index) = False Then MsgBox "错误:Index不是数字": Exit Function
       If UBound(strDatas) < Index Then MsgBox "错误:Index超出数组边界": Exit Function
       If IsNull(strDatas(Index)) = True Then strDatas(Index) = ""
       If Len(strDatas(Index)) < 15 Then
          GetData = ""
          Exit Function
       End If
      

  5.   

       getData = "" 
    出错了,是不是setdata