XML encoding from VBA

exAHSacto

New Member
Joined
Oct 4, 2011
Messages
38
Hi all,

I have an issue regarding encoding in a XML file. I'm using scandinavian letters like "æ, ø, å"... and these are doing the damage.

I loop a selection based on several rows testing if the text are bold etc.

This is the start of my VBA code:

Code:
    Open "C:\test.xml" For Output As #1
    Print #1, "<xml version=""1.0"" encoding=""UTF-8"">"
then it loops through several cells and adds <strong>text</strong> etc.

There are no error when I check the XML file in Notepad++, but when I do the same in e.g. XML Notepad or Firefox i get an error. The error message translated from Danish to English are: "Interpreting XML error: not well-formed" and it highlights the "æ" <-- danish letter.

I have tried changing the encoding from UTF-8 to UTF-16 and ISO-8859-1 but it doesn't help...

What to do?

/Anders
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top