I have installed in my pc MSXML 2.6 MSXML 3.0 MSXML 4.0 MSXML 6.0
when i try to parse my XSL in execution time i have the error Invalid Class String these is the code
Public Sub PreviewDOCUMENT()
Dim ObjXMLTransformDoc
Dim ObjXMLTransformStyle
Dim ObjXMLDoc
Dim ObjXMLStyle
Dim ObjXsltSettings
On Error GoTo ERR_HANDLER
If mResultPath <> "" Then
Set ObjXMLTransformDoc = CreateObject("Msxml2.DOMDocument.4.0")
ObjXMLTransformDoc.Load (mResultPath & MyDocument.DOC_TYPE & "_XML_TO_XSL.xml")
Set ObjXMLTransformStyle = CreateObject("Msxml2.DOMDocument.4.0")
ObjXMLTransformStyle.Load ActiveWorkbook.path & "\RESULT\form_generation.xsl"
ObjXMLTransformStyle.setProperty "AllowXsltScript", True
Set ObjXMLStyle = CreateObject("Msxml2.DOMDocument.4.0")
ObjXMLTransformDoc.transformNodetoObject ObjXMLTransformStyle, ObjXMLStyle
KillFile mResultPath & MyDocument.DOC_TYPE & "_DOCUMENT_STYLE.xsl"
DoEvents
AppendToTextFile mResultPath & MyDocument.DOC_TYPE & "_DOCUMENT_STYLE.xsl", ObjXMLStyle.XML
Dim mSE As New CShellExecute
mSE.LaunchDocument 0, mResultPath & MyDocument.DOC_TYPE & "_XML_TO_XML.xml", ActiveWorkbook.path & "\RESULT\", sesSW_SHOWDEFAULT
Else
MsgBox "Create documents first!"
End If
Exit Sub
ERR_HANDLER:
MsgBox "Error: " & Err.Number & ". " & Err.Description
End Sub
As far as I remember the default loading is asynchronous so for your sequence of code to make sense you need to add ObjXMLTransformDoc.async = False before the ObjXMLTransformDoc.Load load call and ObjXMLTransformStyle.async = False before the ObjXMLTransformStyle.Load call.
Whether the error message you get is related to that I am not sure however. Can you tell us the exact statement or line you get that error for?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With