Tag: 垃圾回收

当variables设置为新对象时,VBA对象是否被销毁?

我还没有find具体的这个问题的答案,所以希望有人可以为我清除它。 我了解VBA垃圾收集器使用引用计数来确定是否不再需要对象,并明确地取消关联使用的variables(从而减less引用计数): Set objectVariable = Nothing 以下是我现在正在处理的电子表格中的内容: Declare Function GetObject Lib "ObjectCreator.dll" () As Object Public MyObject as Object Sub MyMethod() Set MyObject = GetObject() …do stuff with MyObject… Set MyObject = GetObject() …do stuff with my new MyObject… Set MyObject = GetObject() …do stuff with my even newer MyObject… Set MyObject = Nothing End […]