View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jeff
 
Posts: n/a
Default Using "Set" variable

I was looking over the "Set" variable in the help.

It gave the example:

Dim YourObject, MyObject, MyStr
Set MyObject = YourObject ' Assign object reference.
' MyObject and YourObject refer to the same object.
YourObject.Text = "Hello World" ' Initialize property.
MyStr = MyObject.Text ' Returns "Hello World".
' Discontinue association. MyObject no longer refers to YourObject.
Set MyObject = Nothing ' Release the object.

When should you use this? Does it have any advantage over just assigning
MyObject = "Hello World"

Thanks