vba - 设置自定义对象参数时出现堆栈空间不足错误
问题描述
我有一个名为 Service 的自定义类模块,带有字符串参数。我通过创建this_service
这样的对象来实例化该类:
Dim this_service As Service
Set this_service = New Service
然后我尝试将参数设置为任何字符串值,如下所示:
this_service.Key = "HELLO"
当我运行宏时,我得到 28 运行时错误,堆栈空间不足。
在我的类模块服务中,我有以下参数定义和方法调用:
Private pKey As String
Public Property Get Key() As String
Key = pKey
End Property
Public Property Let Key(Value As String)
Key = Value
End Property
我看不出我会收到此运行时错误的任何原因?
解决方案
其中Public Property Let
应该是:
pKey = Value
现在它递归地(无限期地)调用setter。
推荐阅读
- java - 如何在 `addresses.get().getAdressLine()` 中使用特定坐标?
- node.js - 如何在同一台服务器中托管 next.js 和 node.js 服务器?
- elasticsearch - 有没有办法用 Kibana 可视化 typeDB (Grakn) 数据?
- python - altair 图中条件的选择平等
- python - Python argparse 可选的自定义日期+时间,带有很好的使用消息
- wpf - 组合框项目模板的问题
- javascript - 为两个单独的产品类别添加不同的前缀
- c - 长模式下的键盘中断。64位操作系统
- swift - 如何快速访问 AWS Lambda 函数的回调响应?
- python - 如果我没有将任何日期传递给 between 子句,如何从表中获取所有记录?