Does anyone know the reasoning behind having the option using:
Wscript.CreateObject('some.object')
and
CreateObject('some.object')
within VBScript? when I find documentation or examples that use Wscript.CreateObject, I usually rewrite using CreateObject, because it always seems to work, and then I can easily reuse the code within an HTA or ASP. But I’ve always wondered why this feature existed and if what difference it makes if you use one way or another within VBScript.
There’s no difference between the two, when you call them with just one argument. The do exactly the same thing.
The difference between the two is only in evidence if you call with two parameters. The statements
and
do completely different things:
(Adapted from TechNet, section ‘Comparing VBScript CreateObject and GetObject Functions with WSH’.)