Sub XML()
Open "C:\books.xml" For Output As #1
Print #1, "<?xml version=""1.0"" encoding=""iso-8859-9"" ?>"
Print #1, "<books>"
'[COLOR=green]Sorry. In VB, variable's name do not contain "-". It would be underscore "_".[/color]
Dim row_index
row_index = 2 ' First record.
Do Until Cells(row_index, 1) = ""
[COLOR=green]'And I've added two spaces to following lines of codes. [/color]
Print #1, "<book id =" & Chr(34) & Cells(row_index, 1) & Chr(34) & [COLOR=red]" [/color]author-id =" & Chr(34) & Cells(row_index, 2) & Chr(34) & [COLOR=red]" [/color] isbn =" & Chr(34) & Cells(row_index, 3) & Chr(34) & ">" & Cells(row_index, 4) & "</book>"
row_index = row_index + 1
Loop
Print #1, "</books>"
Close #1
End Sub