VBA creates XML but need CSV instead

mrcapitala

New Member
I have this VBA script that will call a webservice and save the data into an XML file. Instead of XML, how can I modify the script to save the data as a CSV file instead? \[code\]Sub Call_Pipeline_Macros() Dim sURL As String Dim sEnv As String Dim xmlhtp As New MSXML2.XMLHTTP Dim xmlDoc As New DOMDocument sURL = "http://service.leads360.com/ClientService.asmx" sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>" sEnv = sEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" sEnv = sEnv & " <soap:Body>" sEnv = sEnv & " <GetReportResults xmlns=""https://service.leads360.com"">" sEnv = sEnv & " <username>[email protected]</username>" sEnv = sEnv & " <password>XXXXX</password>" sEnv = sEnv & " <reportId>565</reportId>" sEnv = sEnv & " </GetReportResults>" sEnv = sEnv & " </soap:Body>" sEnv = sEnv & "</soap:Envelope>" With xmlhtp .Open "post", sURL, False .setRequestHeader "Host", "service.leads360.com" .setRequestHeader "Content-Type", "text/xml; charset=utf-8" .setRequestHeader "soapAction", "https://service.leads360.com/GetReportResults" .setRequestHeader "Accept-encoding", "zip" .send sEnv xmlDoc.LoadXML .responseText xmlDoc.Save "X:\share\Reporting Database\XML Files" & "\565_pipeline_report.xml" End WithEnd Sub\[/code\]
 
Back
Top