11-01-2010, 11:32 PM
A couple of things are wrong here. First, Writeline is a function of the Scripting.FileSystemObject so you can't just call that function without its associated object. To concatenate strings to a variable in VBScript, you simply have to say var = var & "more string". Also, to get quotes in VBScript you simply have to type two together. If you are trying to get soapenv="" in your output, you have to double the quotes in the string constant "soapenv="""">". Seems silly, but that's how it works.
If you are wanting to add the new line character to make the formatting look decent, then you might try something like this:
Kind of messy, but it does the job.
Code:
Dim rackNm, Input_request
rackNm = Array(1, 2, 3, 4, 5)
Input_request = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<soapenv:Header />" & _
"<soapenv:Body>" & _
"<rm:itemSouring>" & _
"<rm:itemNames>"
For Each x In rackNm
Input_request = Input_request & "<rm:item>" & x & "</rm:item>"
Next
Input_request = Input_request & "</rm:itemNames>" & _
"</rm:itemSouring>" & _
"</soapenv:Body>" & _
"</soapenv:Envelope>"
MsgBox Input_request
If you are wanting to add the new line character to make the formatting look decent, then you might try something like this:
Code:
Dim rackNm, Input_request
rackNm = Array(1, 2, 3, 4, 5)
Input_request = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"">" & vbNewLine & _
vbTab & "<soapenv:Header />" & vbNewLine & _
vbTab & "<soapenv:Body>" & vbNewLine & _
vbTab & vbTab & "<rm:itemSouring>" & vbNewLine & _
vbTab & vbTab & vbTab & "<rm:itemNames>" & vbNewLine
For Each x In rackNm
Input_request = Input_request & vbTab & vbTab & vbTab & vbTab & "<rm:item>" & x & "</rm:item>" & vbNewLine
Next
Input_request = Input_request & vbTab & vbTab & vbTab & "</rm:itemNames>" & vbNewLine & _
vbTab & vbTab & "</rm:itemSouring>" & vbNewLine & _
vbTab & "</soapenv:Body>" & vbNewLine & _
"</soapenv:Envelope>"
MsgBox Input_request
Kind of messy, but it does the job.