Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem using MSML reference in VB6

Status
Not open for further replies.

sourabhjha

Programmer
Jan 13, 2002
121
IN
I am using below five statements in my vb program for creating an xml file

Dim blnRes As Boolean
Dim XMLString As String
Dim xmlDoc As New MSXML2.DOMDocument26
XMLString = &quot;<sample-tag attr1=&quot;&quot;3&quot;&quot;>data</sample-tag>&quot;
blnRes = xmlDoc.loadXML(XMLString)

At run time i get error at 5th statement (blnRes = xmlDoc.loadXML(XMLString))with message saying &quot;ActiveX component cannot create objects&quot;
What could be the possible reason
Thanks in advance
-Sourabh
 
Hi sourabhjha,

Is the Microsoft XML v3.0 Library (msxml3.dll) referenced in your project references? - If not it needs to be:-

Toolabar: Project->References

Regards,

Codefish
 
Hi Sourabh,

This is more a VB question then a XML/XSL(T) one, but anyway.. The errormessage typically occurs when you forgot to add a reference to the msxml library (menu: PROJECT -> REFERENCES) or the referenced library isn't installed on your machine at all!

Furthermore never, never, never use the statement 'dim as new' in VB6 (In VB .Net it's ok however). Why? This forum isn't the right place to go into that, look it up in the visual basic 5&6 forum. Best is to use something like the following:
Code:
    Dim blnRes As Boolean
    Dim XMLString As String
    Dim xmlDoc As MSXML2.DOMDocument26
    
    Set xmlDoc = New MSXML2.DOMDocument26

    XMLString = &quot;<sample-tag attr1=&quot;&quot;3&quot;&quot;>data</sample-tag>&quot;
    blnRes = xmlDoc.loadXML(XMLString)

Good luck!

Jordi Reineman
Cap Gemini Ernst & Young
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top