我有以下功能来包含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
当我运行上述操作时,我收到此错误“找不到用户定义的数据类型”。
答案 0 :(得分:0)
是的,正如Ripster所说找到图书馆的参考资料。从VBA窗口工具&gt;参考
有关相关参考文献的清单,请参阅......
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