2

i want to create a UTF-8 encoded .xml file in vba macro. i know how to create .xml file but its default encode is ANSI. i want to change it to UTF-8 and of course, not manually, and I confuse which code to use to create text file because i know two ways:

....
xmlFile = NewFolderName & "\" & Application.Cells(5, j + 1).Value
Open xmlFile For Output As #1
Close #1

....

....
Set objF = objFso.CreateTextFile(xmlFile, True, True)
objF.Close
....

when open this .xml file with notepad, the encode is ANSI. i want the file encoded into UTF-8. can someone help me?

thank you..

squall leonhart
  • 301
  • 1
  • 5
  • 16

1 Answers1

0

not sure but you could try to add to the file at the top of it the following string: <?xml version="1.0" encoding="UTF-8"> I am just working with some xml file and and the top of em this is the string where it should get the encoding if i'm not wrong