Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个类模块。说class1和class2。我想将class2的属性之一设置为class1中的class1。我知道在java中你可以做类似的事情
Class1{ Set Class2Object= This } Class2{ Declare Property as Class1 }
vba 是否与 java 中的“This”等效?谢谢!
在VBA你使用Me而不是this
VBA
Me
this
顺便说一句,VBA你Dim不使用Declare
Dim
Declare
而你没有{,}你只是简单地结束它,End Class所以你的代码应该是这样的
{
}
End Class
Public Class1 Set Class2.Propertyname = Me End Class Public Class2 Dim Propertyname as Class1 End Class
希望这可以帮助