Dim ArrData as Variant
Dim strxml as String
Dim lngInvoice as Long
Dim i as Long
Set ArrData=Sheets([sheet containing the data]).Range("A1").CurrentRegion.Value
strxml = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "ISO-8859-2" & Chr(34) & "?> <Invoices>"
For i = Lbound(ArrData, 1) + 1 to Ubound(ArrData, 1)
NewInvoice:
lngInvoice = ArrData(i, 1)
strxml = strxml & " <invoice_id>" & lngInvoice & "</invoice_id> <invoice_date>" & ArrData(i, 2) & "</invoice_date> ….. <invoice_total> & ArrData(i, 4) & "</invoice_total>"
NewProduct:
strxml = strxml & " <product> <product_name>" & ArrData(i, 5) & "</product_name> …. <total_cost>" & ArrData(i, 8) & "</total_cost> </product>"
If ArrData(i + 1, 1) = lngInvoice then
i = i + 1
GoTo NewProduct
End if
i = i + 1
GoTo NewInvoice
Next i
strxml = strxml & "</invoices>"
Sir,
Sir, share above macro coded excel file in google drive or any other mode.. For my reference...