Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA assigning new object to variable?

I'm trying create new object from a module class in VBA, and I have a small diffcult. Two line of assigning code, look like the same, but result is different.

enter image description here

I got a error message:

enter image description here

After that, I switch to use (1) instead of (2), error was fixed.

enter image description here

But I dont understand; Why do they have this difference?

like image 315
Davuz Avatar asked Aug 18 '26 12:08

Davuz


1 Answers

Dim declares a variable, Set instantiates it.

So, it's a good practice to always have Dim before Set.

like image 115
pat34515 Avatar answered Aug 20 '26 03:08

pat34515



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!