Difference between New and CreateObject

What criteria should I use to decide whether I write VBA code like this:
Set xmlDocument = New MSXML2.DOMDocument
or like this:
Set xmlDocument = CreateObject("MSXML2.DOMDocument")
 
 
 
The basic difference between New and CreateObject:
 
 Objects declared by New keyword are early bound.
 Objects declared by CreateObject are late bound.
 
 >> New is faster than CreateObject.

 

No comments:

Post a Comment