Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MSXML:无效的类字符串_Xml_Xslt_Vb6_Macros_Msxml - Fatal编程技术网

MSXML:无效的类字符串

MSXML:无效的类字符串,xml,xslt,vb6,macros,msxml,Xml,Xslt,Vb6,Macros,Msxml,我已经在我的电脑上安装了 MSXML 2.6 MSXML3.0 MSXML 4.0 MSXML 6.0 当我试图在执行时解析XSL时,出现了一个错误:类字符串无效 这就是代码 Public Sub PreviewDOCUMENT() Dim ObjXMLTransformDoc Dim ObjXMLTransformStyle Dim ObjXMLDoc Dim ObjXMLStyle Dim ObjXsltSettings On Error Go

我已经在我的电脑上安装了 MSXML 2.6 MSXML3.0 MSXML 4.0 MSXML 6.0

当我试图在执行时解析XSL时,出现了一个错误:类字符串无效 这就是代码

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
公共子预览文档()
Dim ObjXMLTransformDoc
Dim ObjXMLTransformStyle
Dim ObjXMLDoc
Dim ObjXMLStyle
Dim OBJXSLT设置
关于错误转到错误处理程序
如果mResultPath为“”,则
设置ObjXMLTransformDoc=CreateObject(“Msxml2.DOMDocument.4.0”)
ObjXMLTransformDoc.Load(mResultPath&MyDocument.DOC_TYPE&“_XML_TO_XSL.XML”)
设置ObjXMLTransformStyle=CreateObject(“Msxml2.DOMDocument.4.0”)
ObjXMLTransformStyle.LoadActiveWorkbook.path&“\RESULT\form\u generation.xsl”
ObjXMLTransformStyle.setProperty“AllowXsltScript”,True
设置ObjXMLStyle=CreateObject(“Msxml2.DOMDocument.4.0”)
ObjXMLTransformDoc.transformNodetoObject ObjXMLTransformStyle,ObjXMLStyle
KillFile mResultPath&MyDocument.DOC\u TYPE&“\u DOCUMENT\u STYLE.xsl”
多芬特
附录文件mResultPath&MyDocument.DOC\u TYPE&“\u DOCUMENT\u STYLE.xsl”,ObjXMLStyle.XML
将mSE调整为新CShellExecute
mSE.LaunchDocument 0、mResultPath和MyDocument.DOC\u TYPE&“\u XML\u TO\u XML.XML”、ActiveWorkbook.path&“\RESULT\”、sesSW\u SHOWDEFAULT
其他的
MsgBox“首先创建文档!”
如果结束
出口接头
错误处理程序:
MsgBox“错误:&错误编号&“&错误说明
端接头

据我记忆所及,默认加载是异步的,因此为了使代码序列有意义,您需要在
ObjXMLTransformDoc.Load
加载调用之前添加
ObjXMLTransformDoc.async=False
,并在
ObjXMLTransformStyle.Load
调用之前添加

不过,我不确定您收到的错误消息是否与此相关。您能告诉我们您得到该错误的确切语句或行吗?

您是否在项目中添加了对msxml4的引用?除此之外,我会使用msxml6,因为它现在是Windows的一部分,不需要单独部署。当我使用msxml6.0时,我有一个错误:Javascript不是脚本语言。这完全令人困惑;-)。关于无效的类字符串,在哪一行出现VB6错误?这一行是:ObjXMLTransformDoc.transformNodetoObject ObjXMLTransformStyle,objxmltransfyle