How to Create xml file when accounting invoice with inventory stored in excel

Anonymous
2019-10-29T12:43:46+00:00

sir, i want to create xml file  when user enter data in vb module form and  data stored in separated sheet and should  auto create invoice template,  i find it user module form with help of https://www.exceltrainingvideos.com/automate-invoice-creation-with-vba/  and how to Generate above data in xml from separated sheet.

i could not write complex macro code for account invoice with inventory, because  unique invoice with date and list of inventory data multiple Row,

i below attached jpeg file - saw, i round on picture,  invoice and date , list of inventory data, that is single invoice with date and also included list of list inventory, and some column also zero,  see IGST in first column and CGST AND SGST in second column, 

Please refer any book or sample code for Accounting invoice xml from Excel, not using excel Mapping , it is not working already i tried.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

16 answers

Sort by: Most helpful
  1. Anonymous
    2019-12-23T16:53:34+00:00

    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...

    0 comments No comments