2016-01-15 81 views
2

我遇到最後一行的類型不匹配錯誤。有任何想法嗎?加入函數的VBA類型不匹配錯誤

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, [, ]) 

回答

1

""[]

language = Join(langOps, ", ") 

[]是評估速記語法和[,]評估爲不能強制爲字符串join錯誤都想因此錯誤)

1

失敗,因爲你使用方括號>>[] < <改爲引號""

language = Join(langOps, [, ]) >>>錯誤

language = Join(langOps, ", ") >>>權