Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 财产的无效使用_Vba_Excel - Fatal编程技术网

Vba 财产的无效使用

Vba 财产的无效使用,vba,excel,Vba,Excel,测试模块 Private Sub fooTest() Dim foo As cSegment Set foo = New cSegment foo.ParseSegment Debug.Print foo.Segment End Sub 课程 Option Explicit Private pElements As Collection Private pSegmentData As String Public Property Let ParseSegme

测试模块

Private Sub fooTest()

   Dim foo As cSegment
   Set foo = New cSegment

   foo.ParseSegment

   Debug.Print foo.Segment

End Sub
课程

Option Explicit

Private pElements As Collection
Private pSegmentData As String

Public Property Let ParseSegment(value As String)
   pSegmentData = value
   ParseElements pSegmentData
End Property
我一直在
foo.ParseSegment
上收到一个错误,说“属性的使用无效”


我不确定这里出了什么问题,因为我理解我的
Let
属性设置正确。有人知道我为什么会收到此错误消息吗?

这是一个属性,而不是一个方法(Sub)。您正试图像调用方法一样调用它。必须将特性指定给

foo.ParseSegment = ""

这是一个属性,let so希望分配一个值:
foo.ParseSegment=something
其中
something
在例程中被设置为
value
。哦,对不起,我的
let
Get
混淆了。。。现在修好了。太完美了。现在效果很好!感谢您的仓促回应:)