title: How to save a string to XML in VBA?
body: <p>I am trying to export the value in "body" to an XML file so I can clearly see what the compiled data looks like before sending in the HTTP request</p>
  
  <p>How do I go about doing that?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Sub API_Test()
  
   body = "&lt;?xml version=""1.0"" encoding=""UTF-8""?&gt;" &amp; _
          "&lt;orders xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""&gt;" &amp; _
          "&lt;order&gt;" &amp; _
          "&lt;orderid&gt;" &amp; Range("A1") &amp; "&lt;/orderid&gt;" &amp; _
          "&lt;operation&gt;" &amp; Range("A2") &amp; "&lt;/operationtype&gt;" &amp; _
          "&lt;/orderid&gt;" &amp; _
          "&lt;/order&gt;" &amp; _
          "&lt;/orders&gt;"
  
   Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
   URL = "http://www.server.com/"
   objHTTP.Open "POST", URL, False
   objHTTP.setRequestHeader "version", "000"
   objHTTP.setRequestHeader "authenticate", "000"
   objHTTP.send (body)
  
  End Sub
  </code></pre>