One difference.
New must have reference, CreateObject does not e.g.
Dim objFSEarly as Scripting.FileSystemObject ' Early binding, need reference
Dim objFSLate as object ' Late binding. No ref
Set objFSEarly = New Scripting.FileSystemObject
Set objFSLate = CreateObject("Scripting.Dictionary"
As well as being faster in execution, early binding (Set myObject = New SomeClass) also lets Intellisense know what you're using, so you get the list of accessible methods when you press "." When you can use "= New" then as a general rule do so.
In VBScript you don't have the option of early binding because the only datatype is Variant, so CreateObject() is the only way to instantiate an object. Also, if you're developing for MTS (and probably COM+, I'm a bit out-of-date OS-wise!) you'll need a lot more CreateObject (and other stuff but that's a different story...)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.