RickBeddoe
Programmer
I am trying to edit an attribute of a XML file using VBA. Here is my code so far:
Dim XMLDOC As DOMDocument
Set XMLDOC = New DOMDocument
Dim myNodes As IXMLDOMNodeList
Dim Node As IXMLDOMNode
Dim attrs As IXMLDOMNamedNodeMap
Dim attr As IXMLDOMAttribute
XMLDOC.Load ("ci.xsd")
Set Node = XMLDOC.selectSingleNode("xsd:schema")
Set attrs = Node.Attributes
Set attr = attrs.getNamedItem("xmlns:ci")
attr.Text = "foo"
The last line generates an error telling me the node is read-only. I have been doing this in C# without a problem and I could make a dll to use in this VBA, but I'm trying to make this a very simple app for someone else to follow in case I get 'downsized'. Is it possible to edit the attribute value using VBA?
TIA
Dim XMLDOC As DOMDocument
Set XMLDOC = New DOMDocument
Dim myNodes As IXMLDOMNodeList
Dim Node As IXMLDOMNode
Dim attrs As IXMLDOMNamedNodeMap
Dim attr As IXMLDOMAttribute
XMLDOC.Load ("ci.xsd")
Set Node = XMLDOC.selectSingleNode("xsd:schema")
Set attrs = Node.Attributes
Set attr = attrs.getNamedItem("xmlns:ci")
attr.Text = "foo"
The last line generates an error telling me the node is read-only. I have been doing this in C# without a problem and I could make a dll to use in this VBA, but I'm trying to make this a very simple app for someone else to follow in case I get 'downsized'. Is it possible to edit the attribute value using VBA?
TIA