Link to home
Start Free TrialLog in
Avatar of DaneBigham
DaneBighamFlag for United States of America

asked on

Create a single tag XML element using VBA

I have an MS Access application that generates XML, using the MSXML2 DOM object.  I have code that looks like this:

            Set objSubElem = objDoc.createElement("FieldName")
            objElem.appendChild objSubElem
            objSubElem.Text = "UNIT=""in"" VALUE=""" & rs("Field1") & """"

Open in new window


Which creates output like this:

          <FieldName>UNIT="in" VALUE="0.13529"</FieldName>

However, I'd like the output to result in a single tag, looking like this:

          <FieldName UNIT="in" VALUE="0.13529" />

Is there a setting or attribute I can tweak to get the desired result?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DaneBigham

ASKER

Perfect.  Thanks.