ByRef参数类型在VBA中不匹配

时间:2014-09-22 13:45:25

标签: vba

我写了像

这样的代码
sub something
    Dim symbols as Symboldetail
    Dim errorSymbols as Symboldetail
    Dim anyError as boolean
    Dim name, id as String
    set symbols = new Symboldetail
    set errorSymbols = new Symboldetail 
    anyerror = funName("","",symbols ,errorSymbols)
end sub

Function funName(ByVal name As String,ByVal id As String, ByRef symbols as Symboldetail,ByRef errorSymbols as Symboldetail) As Boolean
    'here editing the values of symbols and errorSymbols
     funName = false/true
end Fuction

当我编译此代码时,它会抛出错误" ByRef参数类型不匹配"

我不知道我在做什么是

提前致谢

1 个答案:

答案 0 :(得分:1)

我开始知道我做了什么错误

'i declared these variables like 
Dim symbols, errorSymbols as Symboldetail

'instead of 
'Dim symbols as Symboldetail
'Dim errorSymbols as Symboldetail

所以它将符号作为变量而不是Symboldetails,因为当我传递变量时它会将错误抛出为“类型错误匹配错误”

@all感谢您的宝贵意见