关键字 Set 在 VBA 中实际上有什么作用? [英] What does the keyword Set actually do in VBA?
本文介绍了关键字 Set 在 VBA 中实际上有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望是一个简单的问题,但我非常想要一个技术性的答案!
Hopefully an easy question, but I'd quite like a technical answer to this!
有什么区别:
i = 4
和
Set i = 4
在 VBA 中?我知道后者会抛出错误,但我不完全明白为什么.
in VBA? I know that the latter will throw an error, but I don't fully understand why.
推荐答案
set
用于为对象分配引用.C 等价物将是
set
is used to assign a reference to an object. The C equivalent would be
int i;
int* ref_i;
i = 4; // Assigning a value (in VBA: i = 4)
ref_i = &i; //assigning a reference (in VBA: set ref_i = i)
这篇关于关键字 Set 在 VBA 中实际上有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文