A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello Ivan Hrasko,
Thank you for posting in Microsoft Q&A.
I understand that you are experiencing diacritics not displaying correctly in the VBA editor for Microsoft 365 Excel.
The VBA editor in Office relies on legacy ANSI code pages, not full Unicode support, which means:
- If your system locale or font settings don't match the language of the diacritics, they will appear as ?.
- If you select a font like Courier New, the editor may not properly render characters unless the system locale supports them.
Here are some steps that you can kindly follow to help resolve this:
- Change your system locale:
- Visit Control Panel > Region > Administrative tab > Change system locale.
- Set it to the language that supports your diacritics.
- Restart your PC after applying changes.
- Font Settings in VBA Editor:
- In the VBA editor, go to Tools > Options > Editor Format.
- Choose a font that supports your language.
- Avoid Unicode in VBA
- VBA Editor doesn't support Unicode for code text. If you need Unicode characters in strings, use ChrW() or AscW() functions in your code:
MsgBox ChrW(&H010D) ' Example for č
- VBA Editor doesn't support Unicode for code text. If you need Unicode characters in strings, use ChrW() or AscW() functions in your code:
- Replace Accented characters programmatically:
- If you need to strip diacritics, you can use VBA function:
Function StripAccent(ByVal s As String) As String
Dim AccChars As String, RegChars As String, i As Integer
AccChars = "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
RegChars = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"
For i = 1 To Len(AccChars)
s = Replace(s, Mid(AccChars, i, 1), Mid(RegChars, i, 1))
Next
StripAccent = s
End Function
I hope it helps, please feel free to let me know if you need any further assistance.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.