VBAtypes与join函数不匹配错误
我遇到了与最后一行types不匹配的错误。 有任何想法吗?
Dim language As String Dim langOps(0 To 2) As String If CheckBox10.Value = True Then langOps(0) = CheckBox10.Caption End If If CheckBox15.Value = True Then langOps(1) = CheckBox15.Caption End If If CheckBox29.Value = True Then langOps(2) = CheckBox29.Caption End If language = Join(langOps, [, ])
""
不[]
language = Join(langOps, ", ")
( []
是评估速记语法, [,]
计算结果是一个错误,不能强制为stringjoin
想要因此错误)
因为您使用方括号>> []
<<而不是引号""
失败。
language = Join(langOps, [, ])
>>>错误
language = Join(langOps, ", ")
>>>正确