生成xml时 存储空间不足,无法完成操作
Dim iii, ii As Integer
Dim TableName As String
Dim tempDoc As MSXML2.DOMDocument 'xml文件
Dim tempNode As MSXML2.IXMLDOMNode
Dim Root As MSXML2.IXMLDOMElement
Dim tempelement As MSXML2.IXMLDOMElement
Dim tempattribute As MSXML2.IXMLDOMElement
Dim emp As MSXML2.IXMLDOMElement
TableName = "XML" & Format(Now(), "MMDDHHMMSS")
'生成一个XML DOMDocument对象
Set tempDoc = New MSXML2.DOMDocument
'生成根节点并把它设置为文件的根
Set Root = tempDoc.createElement(TableName)
Set tempDoc.documentElement = Root
For iii = 1 To VsGrid.Rows - 1
Set emp = tempDoc.createNode(MSXML2.NODE_ELEMENT, TableName, "")
Root.appendChild emp
For ii = 1 To VsGrid.Cols - 1
'生成孩子节点添加到根节点上去,并且为这个节点设置一个属性
Set tempNode = tempDoc.createNode(MSXML2.NODE_ELEMENT, Trim(VsGrid.TextMatrix(0, ii)), "")
tempNode.Text = Trim(VsGrid.TextMatrix(iii, ii)) emp.appendChild tempNode
Next ii
Next iii
Dim pi As IXMLDOMProcessingInstruction
Set pi = tempDoc.createProcessingInstruction("xml", "version='1.0' encoding='gb2312'")
Call tempDoc.insertBefore(pi, tempDoc.childNodes(0))
'直接保存成文件即可
tempDoc.Save FileName
ExportXml = True
错误在红色字的那行。提示的错误是“存储空间不足,无法完成操作”
所要导的数据超过50w