Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I instanciate a MSXML2.XMLHTTP60 object?

834 views
Skip to first unread message

gimme_this...@yahoo.com

unread,
Oct 29, 2008, 5:58:02 PM10/29/08
to
Hi,

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.


ekkehard.horner

unread,
Oct 30, 2008, 4:44:09 AM10/30/08
to
gimme_this...@yahoo.com schrieb:
Try:

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.


gimme_this...@yahoo.com

unread,
Nov 1, 2008, 6:58:31 PM11/1/08
to
This was helpful. Thanks.
0 new messages