我有一個簡單的屬性(pName)自己的類(ClassFoo),我無法設置它,因爲我總是得到錯誤...Excel 2010 VBA - 錯誤:對象變量或與塊變量未設置
Class Modules - ClassFoo
---
Public pName as String
Public Property Let Name(Value as String)
pName = Value
End Property
----
Somewhere else in the ModuleX
...
Dim Foo as ClassFoo
Foo.Name = "foo" <- throws error
Foo.pName = "foo" <- throws error
或
With Foo
.pName = "foo" <- throws error
End With
我改變了類的實例化「從「民營」到「PublicNotCreatable」(來回) 但我仍然有同樣的錯誤...
感謝˚F或提前回復。
銫
感謝您的幫助!它的工作原理 – cscsaba