Fix Question Marks Appearing in Spreadsheet VBA Modules
Question details
Non-Latin characters display as question marks in the Visual Basic Editor and macro messages.

- Product
- Spreadsheets
- Device & OS
- not provided
- Scenario
- Typing, pasting, or displaying text containing non-Latin characters (like Greek, Cyrillic, or Arabic) within VBA code or message boxes.
- Observed behavior
- The text characters are incorrectly converted to and displayed as question marks (?).
Confirm whether your script strictly requires embedded special characters, as standard VBA editors have limited native support for Unicode character sets.
Store and Retrieve Unicode Text from Worksheet Cells
Bypass the VBA Editor's text encoding limitations by keeping special characters in the spreadsheet rather than the code.
Because the standard Visual Basic Editor converts unsupported Unicode characters to question marks, directly hardcoding non-Latin text is not recommended. You can safely store these strings in the spreadsheet cells, which have full Unicode support.
Open your workbook and type the required non-Latin characters (e.g., Arabic or Cyrillic) directly into a specific cell, such as A1 on Sheet1.
In your macro, read the value directly from the cell using code like 'myText = Sheets("Sheet1").Range("A1").Value' instead of typing the string inside quotes.

Use the ChrW Function for Specific Characters
Construct strings natively in VBA using exact Unicode values to avoid typing unsupported characters.
Write and Execute VBA Macros Efficiently in WPS Spreadsheet
WPS Office Spreadsheet provides excellent support for VBA macros, allowing you to create, edit, and run complex scripts to automate your workflow seamlessly.
- 1. Open your Spreadsheet: Launch WPS Spreadsheet and open your macro-enabled workbook containing your data.
- 2. Access Developer Tools: Navigate to the Developer tab on the top ribbon. If hidden, you can enable it through the software settings.
- 3. Open Visual Basic Editor: Click on 'Visual Basic' or press Alt+F11 to open the code editor and manage your VBA scripts.

Frequently Asked Questions
Why do foreign languages look like question marks in my VBA code?
The Visual Basic Editor operates on standard ANSI encoding. When you insert characters outside your system's default locale (like Arabic, Cyrillic, or Greek), the editor cannot recognize them and defaults to showing question marks.
Can I change the font in the VBA Editor to fix the question marks?
Changing the editor font in the VBE Options to a font that supports the required character set (like Arial Unicode MS) may help display characters properly, but only if your Windows system locale matches the language you are trying to display.
How can I display Unicode text in a popup message if MsgBox shows question marks?
The built-in VBA MsgBox function does not natively support Unicode. To display non-Latin text properly to users, you can design a custom UserForm with text labels, or use the Windows API MessageBoxW function.




