MPW
Well-known Member
- Joined
- Oct 7, 2009
- Messages
- 571
- Office Version
- 365
- Platform
- Windows
Hi, I have created an xml file that is based on data from Excel. However, the result is that it is in an ansi format. The program that uses this file requires the utf-8 format and I am currently able to emulate this by throwing it into Notepad++ to format it correctly. I would like to accomplish this automatically.
I best code I found in several places on the web was this:
Unfortunately, this results in the "utf-16 BE BOM" instead of the desired "utf-8".
My question is "How can I modify the above code to get the right output or is there a better method?"
Thank you for the use of your brains.
I best code I found in several places on the web was this:
VBA Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set stream = CreateObject("ADODB.Stream")
stream.Open
stream.Type = 2
stream.Charset = "utf-8"
stream.LoadFromFile strPath
fso.OpenTextFile(strPath, 2, True, True).Write stream.ReadText
stream.Close
My question is "How can I modify the above code to get the right output or is there a better method?"
Thank you for the use of your brains.