Share via

how do I get Chinese characters in documents and document names to show up in Word VBA Visual basic Editor?

Edward Evans 20 Reputation points
2026-04-01T23:55:18.2666667+00:00

I am trying to use VBA editor to write macros for Microsoft Word documents in traditional Chinese (Unicode UTF8) characters but the characters only show up as repeated question marks in the VBA editor. I am trying to do repeated searches in a document, and the searches fail to find instances of the items being searched that are definitely there. In the editor, it's not possible to tell if the item I'm asking to be found is rendered properly.

Microsoft 365 and Office | Word | For home | Windows

2 answers

Sort by: Most helpful
  1. Kai-H 14,825 Reputation points Microsoft External Staff Moderator
    2026-04-02T07:26:47.4766667+00:00

    Hi, Edward Evans

    Word itself is Unicode-aware, so the document can store and show Traditional Chinese correctly, but the VBA editor can still show those characters badly when you type or paste them there. Word also supports Unicode text files, and on Windows VBA can create Unicode characters with ChrW, so the macro can still search correctly even if the editor display is messy.

    Solution: Here are some suggestions you can try:

    Don’t type the Chinese text directly in the VBA editor. Build the search text with ChrW, for example FindText = ChrW(&H4E2D) & ChrW(&H6587). ChrW returns a Unicode character in Windows, and Word’s Find.Execute uses the text you pass in FindText.

    It is recommended that the Chinese terms be stored outside the code, then loaded into a string when the macro runs, instead of hard-coding them in the editor. That avoids the VBE input/display problem.

    In Windows, change the system locale for non-Unicode programs to Traditional Chinese, then restart the PC. It is suggested this can help the VBA editor show Chinese properly.

    Also check Word > File > Options > Language and add Chinese (Traditional) as an authoring language so the related language support is installed.

    Thank you for your patience in reading, I hope this information has been helpful to you. 


    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. 


  2. Q&A Assist
    2026-04-02T00:07:53.4066667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Word’s VBA editor does not work in full UTF‑8/Unicode; it is bound to legacy Windows code pages and only reliably handles characters that map into those code pages plus what the editor font can display. When Traditional Chinese text appears as ??? in the VBA editor and searches fail, the underlying characters are not being represented in the code page that VBA is using.

    Key technical points from the specifications and Word behavior:

    1. VBA uses Windows code pages for non‑Latin characters
      • VBA support for Traditional Chinese identifiers is based on Windows Codepage 950 (Big5). Characters are encoded as 16‑bit double‑byte characters with code points starting at %xA140, and then mapped to Unicode.
      • VBA support for Simplified Chinese identifiers is based on Windows Codepage 936 (GB2312/GBK), with double‑byte characters starting at %x8140.
      • Non‑Latin identifiers and characters are defined in terms of these legacy code pages, not arbitrary Unicode. Only characters that have a defined mapping in these code pages are guaranteed to be valid in identifiers and string literals.
    2. Valid ranges for Chinese characters in VBA
      • For Traditional Chinese identifiers, a valid initial or subsequent character must correspond to code points in CP950 such as %xA2CF-A2FE and %xA340-F9DD, with a few additional points allowed for subsequent characters.
      • For Simplified Chinese identifiers, valid characters correspond to CP936 ranges such as %xA3C1-A3DA, %xA3E1-A3FA, %xA1B2-A1E6, %xA2B1-A2FC, %xA4A1-FE4F, etc.
      • More generally, VBA allows any Unicode character that maps to a single‑byte code point in the range %x80-FF in supported Windows code pages (874, 1250–1258) as non‑Latin characters, but Chinese ideographs are handled via the double‑byte CP936/CP950 rules above.
      If a Traditional Chinese character in the document does not map to a valid CP950 code point, VBA cannot represent it correctly in identifiers or string literals, and it may show as ? in the editor.
    3. Difference between Word document text and VBA editor
      • Word documents themselves are stored as Unicode and can display Traditional Chinese correctly using appropriate fonts (for example, MingLiU for Traditional Chinese, SimSun for Simplified Chinese) as listed in Word’s encoding support.
      • The VBA editor is constrained by the system code page and its own font handling. Even if Word shows the document text correctly, the editor may:
        • Replace unsupported characters with ? when typing or pasting them into code.
        • Fail to store the intended Unicode characters in the string literal, so the string in code no longer matches the document text.
    4. Why searches fail from VBA
      • When a search string in VBA appears as ???, the actual stored characters are question marks, not the intended Chinese characters.
      • Word’s Find/Replace from VBA compares the literal string in code (now ???) with the document’s Unicode text, so no matches are found even though the Chinese text is present.
    5. What is required for Chinese characters to work in VBA code Within the constraints of the provided specifications:
      • The Traditional Chinese characters used in VBA must be characters that exist in Windows Codepage 950 and fall within the allowed ranges for CP950 identifiers/strings. Characters outside those mappings cannot be reliably represented in VBA code.
      • The environment must use fonts that support Traditional Chinese for the relevant encoding. Word associates Traditional Chinese with encodings such as BIG5/EUC‑TW/ISO‑2022‑TW and uses fonts like MingLiU; if the editor font or system settings do not support these, characters may not display correctly even if they are technically mapped.
      • Because VBA’s non‑Latin support is defined in terms of legacy code pages, it cannot act as a general UTF‑8 editor. Arbitrary Unicode Traditional Chinese characters that do not map into CP950 will not display or function correctly in VBA code.
    6. Practical implications for macros Given these limitations, reliable approaches are:
      • Restrict Chinese characters used directly in VBA string literals to those that are mapped in CP950 (for Traditional Chinese) or CP936 (for Simplified Chinese), so they can be represented and displayed correctly.
      • Use Word’s Unicode document support for the full range of Chinese characters, but avoid relying on those characters directly in VBA identifiers or string literals when they are not in the CP950/CP936 mappings.
      • Where characters cannot be represented in VBA, use alternative mechanisms (for example, bookmarks, styles, or other metadata) to locate content instead of literal Chinese search strings.

    Because VBA’s design predates Unicode and is explicitly tied to Windows code pages, it cannot be made to behave as a full UTF‑8/Unicode editor. Only characters that map through the appropriate Windows code pages (especially CP950 for Traditional Chinese) will display correctly in the Visual Basic Editor and work reliably in searches.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.