Webサービスを呼び出してデータをXMLファイルに保存するこのVBAスクリプトがあります。XMLの代わりに、スクリプトを変更してデータをCSVファイルとして保存するにはどうすればよいですか?
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>vtorralbes@globalhealtheducation.com</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 With
End Sub