0
我創建了一個名爲BitArray的自定義類。 BitArray的方法之一Append將BitArray作爲參數。下面是Append方法聲明:VBA(Office 2010)自定義類方法拋出「對象不支持此屬性或方法」錯誤
Public Function Append(ByVal newBits As BitArray)
(我也試過路過newBits的ByRef沒有效果)
在我的代碼,我有這樣的事情:
Dim baBits1 As BitArray
Dim baBits2 As BitArray
Set baBits1 = New BitArray
Set baBits2 = New BitArray
baBits1.Append (baBits2)
最後一行拋出438錯誤。奇怪的是,如果我將代碼添加到Append並直接執行,它就可以工作。因此,Append中的邏輯或語法沒有內在的錯誤。 VBA不喜歡可以接受自己的類作爲參數的類方法嗎?
正確的調用是'baBits1.Append baBits2'或'Call baBits1.Append(baBits2)'。這些工作嗎? – Andre