Hey!
I have excel .xlsx workbook with loaded xml source. I take one row from sheet "Clients" and copy it to row "Data", then export is as XML with name changed according the data from the copied row and then use it in other ways. I have found one VBA in this forum that helped me solve the copying part:
Sub copyrows()
Dim i As Long
With Sheets("Clients")
For i = 2 To .Range("A" & Rows.Count).End(3).Row
If WorksheetFunction.Trim(.Range("A" & i).Value) = "" Then Exit Sub
.Rows(i).Copy Sheets("Data").Range("A2")
ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & .Range("G" & i) & " " & .Range("F" & i) & ".xml"
Next
End With
End Sub
The issue with this is, that the .xml file after is unusable for me. There's not the right code and instead get weird signs or numbers. I've tried Workbook.SaveAsXMLData with some options but that didn't work (always some mistake in the code). So does anyone have an idea how to deal with this?
I have excel .xlsx workbook with loaded xml source. I take one row from sheet "Clients" and copy it to row "Data", then export is as XML with name changed according the data from the copied row and then use it in other ways. I have found one VBA in this forum that helped me solve the copying part:
Sub copyrows()
Dim i As Long
With Sheets("Clients")
For i = 2 To .Range("A" & Rows.Count).End(3).Row
If WorksheetFunction.Trim(.Range("A" & i).Value) = "" Then Exit Sub
.Rows(i).Copy Sheets("Data").Range("A2")
ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & .Range("G" & i) & " " & .Range("F" & i) & ".xml"
Next
End With
End Sub
The issue with this is, that the .xml file after is unusable for me. There's not the right code and instead get weird signs or numbers. I've tried Workbook.SaveAsXMLData with some options but that didn't work (always some mistake in the code). So does anyone have an idea how to deal with this?