Question

I know that I can use a With statement to make repeated references to a single object:

With myObj
  .StringProperty = ""
  .BooleanProperty = False
End With

However, what I want to know is: is there a shorthand for referring to the original object in the With statement? In the above example, can I refer to myObj without explicitly typing myObj as I'm already working with it.

Was it helpful?

Solution

No you can't, but it wouldn't mean much anyway. With just sets the default scope to the object expression that follows it. If you need a reference to the object this doesn't help unless the object is one of the very few that has a .Self property, which is quite rare.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top