2

I'm writing a macro in MS Project. In a form I'm using Date and Time Picker control. And I have to use German locale. The problem is in the point that VBA doesn't display umlauts correct and März looks like Mдrz in the Calendar.

I have problem with MsgBox too. Special symbols ü, ö, ä, ß are displayed like ь, ц, д, Я in message. I’ve tried to use the `CharW()? function to display Unicode symbols, and symbols displays like o, u, a?

I set de-DE locale in MS Project and German locale on my computer, but it did not help.

Is it possible to explicitly use utf-8 encoding in VBA?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Shalaieva
  • 21
  • 2
  • Linked question: [ms access - How do I display a messagebox with unicode characters in VBA? - Stack Overflow](https://stackoverflow.com/questions/55210315/how-do-i-display-a-messagebox-with-unicode-characters-in-vba) although that one does not handle characters in form labels. – user202729 Sep 29 '21 at 05:43

1 Answers1

0

Try not to display the ä in the VBA code. It really looks bad and it is a bad practice to have anything but the standard latin characters there. The strings could stay in a database/excel sheet and could be accessed from there, which is the good practice.

Anyway, for the bad practice:

ä - ChrW(&H00E4)

The rest is available here: https://en.wikipedia.org/wiki/List_of_Unicode_characters

Vityata
  • 42,633
  • 8
  • 55
  • 100
  • 1
    This is an interesting article for Unicode - https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/ – Vityata Aug 30 '19 at 11:13
  • thank you for your answer. Unfortunately bad practice doesn't work too, _ä_ looks like _a_ in message. And I still need to do something with _Mдrz_ in Calendar, because I can't change system name of month. – Shalaieva Aug 30 '19 at 13:05
  • 1
    @Shalaieva - for a messagebox, you cannot do it, but you would be able to write it somewhere in the app, which uses a string. See a bit more here - https://stackoverflow.com/questions/55210315/how-do-i-display-a-messagebox-with-unicode-characters-in-vba – Vityata Aug 30 '19 at 13:30