保存する前にindents XMLドキュメントのVBA subを書きました。インデントは、Visual Studioで書式設定するときに表示されるものと似ています。サブ要素やCDatasだけでなく、
Sub IndentXml(xml As IXMLDOMElement, Optional depth As Integer)
If IsMissing(depth) Then
depth = 0
End If
Dim txt As IXMLDOMText
If Not (xml.OwnerDocument.DocumentElement Is xml) Then
Set txt = xml.OwnerDocument.createTextNode(vbNewLine & String(depth, vbTab))
xml.ParentNode.InsertBefore txt, xml
End If
Dim child As IXMLDOMNode
Dim hasElements As Boolean
hasElements = False
For Each child In xml.ChildNodes
If child.NodeType = NODE_ELEMENT Then
IndentXml child, depth + 1
hasElements = True
ElseIf child.NodeType = NODE_CDATA_SECTION Then
Set txt = xml.OwnerDocument.createTextNode(vbNewLine & String(depth + 1, vbTab))
xml.InsertBefore txt, child
hasElements = True
End If
Next
If hasElements Then
Set txt = xml.OwnerDocument.createTextNode(vbNewLine & String(depth, vbTab))
xml.appendChild txt
End If
End Sub
ありがとう - 来週に試してみます – HorusKol