Want to generate xml from excel data.VBA code(need improvement) attached herewith.Want to loop data from second row to last row.
Thank you.
Thank you.
Date | Debit | Credit | No. | Type | Ledger | Bank |
01/04/2020 | 500000 | 1 | Payment | Test Account | Bank | |
02/04/2020 | 110000 | 2 | Receipt | Test Account1 | Bank | |
03/04/2020 | 15000 | 3 | Payment | Test Account5 | Bank | |
04/04/2020 | 10000 | 4 | Payment | Test Account | Bank | |
05/04/2020 | 15000 | 5 | Receipt | Test Account9 | Bank | |
06/04/2020 | 100000 | 6 | Payment | Test Account | Bank | |
07/04/2020 | 500000 | 7 | Receipt | Test Account | Bank | |
08/04/2020 | 500000 | 8 | Receipt | Test Account10 | Bank |
VBA Code:
Sub export()
XMLFileName = ThisWorkbook.Path & "\" & "Test" & ".xml"
Open XMLFileName For Output As #1
Print #1, "<ENVELOPE>"
Print #1, "<HEADER>"
Print #1, "<TALLYREQUEST>Import Data</TALLYREQUEST>"
Print #1, "</HEADER>"
Print #1, "<BODY>"
Print #1, "<IMPORTDATA>"
Print #1, "<REQUESTDESC>"
Print #1, "<REPORTNAME>Vouchers</REPORTNAME>"
Print #1, "<STATICVARIABLES>"
Print #1, "<SVCURRENTCOMPANY>TEST CO</SVCURRENTCOMPANY>"
Print #1, "</STATICVARIABLES>"
Print #1, "</REQUESTDESC>"
Print #1, "<REQUESTDATA>"
Print #1, "<TALLYMESSAGE xmlns:UDF=""TallyUDF"">"
Print #1, "<VOUCHER REMOTEID="""" VCHKEY="""" VCHTYPE=""Payment"" ACTION=""Create"" OBJVIEW=""Accounting Voucher View"">"
Print #1, "<OLDAUDITENTRYIDS.LIST TYPE=""Number"">"
Print #1, "<OLDAUDITENTRYIDS>-1</OLDAUDITENTRYIDS>"
Print #1, "</OLDAUDITENTRYIDS.LIST>"
Print #1, "<DATE>20200407</DATE>"
Print #1, "<VOUCHERTYPENAME>Payment</VOUCHERTYPENAME>"
Print #1, "<VOUCHERNUMBER>5</VOUCHERNUMBER>"
Print #1, "<LEDGERNAME>Suspense Account</LEDGERNAME>"
Print #1, "<AMOUNT>-1500000.00</AMOUNT>"
Print #1, "<LEDGERNAME>Bank Account</LEDGERNAME>"
Print #1, "<AMOUNT>1500000.00</AMOUNT>"
Print #1, "</VOUCHER>"
Print #1, "</TALLYMESSAGE>"
Print #1, "</REQUESTDATA>"
Print #1, "</IMPORTDATA>"
Print #1, "</BODY>"
Print #1, "</ENVELOPE>"
Close #1
End Sub