0

我有以下功能来包含 cdata:

Function cdatasection()
    Dim objDom As DOMDocument
    Dim objKMLRootelement As IKMLDOMElement
    Dim objKMLelement As IKMLDOMElement
    Dim cdata As IKMLDOMCDATASection

    Set objDom = New DOMDocument
    Set objKMLRootelement = objDom.createElement("BalloonStyle")
    objDom.appendChild objKMLRootelement
    Set objKMLelement = objDom.createElement("text")
    objKMLRootelement.appendChild objKMLelement
    Set cdata = objDom.createCDATASection("text")
    cdata.Data = "<![CDATA[<b>Latitude = $[latitude]</b>?]]>;"
End Function

当我运行上述程序时,我收到此函数的错误“未找到用户定义的数据类型”。

4

1 回答 1

0

是的,正如 Ripster 所说,找到库参考。从 VBA 窗口工具>参考

有关相关参考的列表,请参阅...

http://msdn.microsoft.com/en-us/library/windows/desktop/ms763701%28v=vs.85%29.aspx

但是,如果您很难跟踪参考,请替换所有Dim语句并Set objDom = New DOMDocument...

Dim objDom as Object
Set objDom = CreateObject("Microsoft.XMLDOM") ' EDIT: If this does not work, try...
'Set objDom = CreateObject("MSXML22.DOMDocument.6.0")


Dim objKMLRootelement As Object
Dim objKMLelement As Object    
Dim cdata As Object
于 2013-07-31T21:36:19.597 回答