In My VBScript the following instruction creates a Microsoft.XMLHTTP
version three object.
Set oHTTP = WScript.CreateObject("Microsoft.XMLHTTP")
How do I tell VBScript to create a Microsoft.XMLHTTP version six
object?
In Excel the instruction would be:
Set xml = New XMLHTTP60
Thanks.
Dim aTests : aTests = Array( _
"Microsoft.XMLHTTP" _
, "Msxml2.XMLHTTP" _
, "Msxml2.XMLHTTP.3.0" _
, "Msxml2.XMLHTTP.4.0" _
, "Msxml2.XMLHTTP.5.0" _
, "Msxml2.XMLHTTP.6.0" _
, "Microsoft.XMLHTTP.6.0" _
, "Msxml2.XMLHTTP.7.0" _
)
Dim sProgId, sTypeName
For Each sProgId In aTests
Dim oX
On Error Resume Next
Set oX = CreateObject( sProgId )
If 0 = Err.Number Then
sTypeName = TypeName( oX )
Else
sTypeName = Err.Description
End If
On Error GoTo 0
WScript.Echo sProgId, "=>", sTypeName
Next
output (here):
Microsoft.XMLHTTP => IXMLHTTPRequest
Msxml2.XMLHTTP => IXMLHTTPRequest
Msxml2.XMLHTTP.3.0 => IXMLHTTPRequest
Msxml2.XMLHTTP.4.0 => ActiveX component can't create object
Msxml2.XMLHTTP.5.0 => IServerXMLHTTPRequest2
Msxml2.XMLHTTP.6.0 => IServerXMLHTTPRequest2
Microsoft.XMLHTTP.6.0 => ActiveX component can't create object
Msxml2.XMLHTTP.7.0 => ActiveX component can't create object
Looks like "Msxml2.XMLHTTP.6.0" is the way to go, but make
sure it's the object you really want to get.