Excel VBA’s built-in InputBox accepts text entered with a Windows IME (Input Method Editor), such as Japanese, Chinese, or Korean text. It uses the input method and mode currently active in Windows; the built-in dialog does not offer a setting to turn the IME on, choose a language, or force a particular character mode.
What IME means in an Excel InputBox
An IME lets a user enter characters that are not typed as one character per key. For example, someone may type a phonetic spelling, then choose a suggested kanji or other character from a conversion list. The IME handles that composition while the user is focused in the text field; after the user commits the composition, Excel receives the resulting text.
The VBA InputBox is a small, modal dialog: while it is open, the user must respond to it before returning to the workbook. It does not contain its own language-entry engine. Windows supplies the keyboard layout and input method, and the dialog accepts text through the active input system. This means an InputBox can collect IME-entered text without special VBA code, provided the relevant input method is installed, enabled, and selected.
“IME support” does not mean that the dialog automatically switches into Japanese, Chinese, or Korean input. Nor does it mean that a macro can reliably determine which language the user intends. The user may need to select an input language or switch modes using Windows’ language controls. On Windows, Win+Space opens the input-language selector when multiple options are available; the exact installed choices depend on the computer.
What happens while the built-in dialog is open
During IME composition, the characters shown in the field may be provisional. The user can still be choosing a candidate or converting typed phonetic characters. The text is not necessarily final just because it appears on screen. Usually, the user commits the composition with the IME’s normal action, such as choosing a candidate or pressing Enter, and then confirms the dialog. Depending on the IME, pressing Enter once may commit the composition and a second press may submit the InputBox.
This distinction explains a common surprise: a macro can appear to accept only part of a Japanese or Chinese entry if the user submits before completing conversion. That is generally a composition or interaction issue, not evidence that VBA cannot store the characters. VBA strings can hold Unicode text, and ordinary text returned by an InputBox can contain non-Latin characters.
Likewise, the dialog does not validate the language or script. If a prompt expects a Japanese name, the user can still enter Latin letters, digits, or another script. The macro must validate the result if the workbook has a specific requirement; an InputBox prompt is guidance, not an input restriction.
VBA InputBox versus Application.InputBox
Excel VBA offers two commonly used dialogs with similar names. The VBA InputBox function is a general text prompt. Excel’s Application.InputBox method can constrain the kind of response using its Type argument. Neither is a language selector, and neither provides a direct argument for setting the IME mode.
VBA.InputBox: Useful for a simple text response. If the user clicks Cancel, it returns an empty string, just as it does if the user submits the dialog without entering text. Those two outcomes are therefore hard to distinguish.Application.InputBoxwithType:=2: Requests text and returns a Variant. Cancel returns the Boolean valueFalse, which can be distinguished from submitted text that happens to be empty.- Other response types:
Application.InputBoxcan request numbers, formulas, ranges, and other supported types. These options validate the kind of response, not its language or IME composition.
For a multilingual free-text field, the text type is usually the relevant choice. For a cell reference or numeric value, choose an appropriate type and handle cancellation and invalid input deliberately. Do not assume the dialog will translate, convert, or normalize a response.
Example: collect text and handle Cancel
This example uses Excel’s text InputBox and checks for the Boolean Cancel result before treating the response as text. Before running a macro, save a copy of the workbook: macro actions cannot be undone with Ctrl+Z.
Sub AskForTextWithExcelInputBox()
Dim answer As Variant
' Request text; Cancel returns Boolean False.
answer = Application.InputBox( _
Prompt:="Enter text using your preferred input method:", _
Title:="Text entry", _
Type:=2)
If VarType(answer) = vbBoolean Then
If answer = False Then
MsgBox "Entry cancelled."
Exit Sub
End If
End If
If Len(CStr(answer)) = 0 Then
MsgBox "No text was entered."
Exit Sub
End If
MsgBox "You entered: " & CStr(answer)
End Sub
The macro accepts the text as entered, including IME-converted characters. It does not check whether the response uses a particular script. The empty-string check handles a submitted blank response separately from Cancel; whether blank text is acceptable is a decision for the workbook’s workflow.
If you use the VBA function instead, remember that an empty response and Cancel both produce "". A simple version is answer = VBA.InputBox("Enter a name:", "Name"), but the macro cannot tell those two cases apart from that return value alone.
Common IME and InputBox problems
- Text appears in the wrong script: Check the active Windows input language and IME mode. The dialog does not choose the intended language based on its prompt.
- Only the phonetic characters appear: Finish conversion and commit the candidate before submitting the dialog. Some IMEs need one action to commit composition and another to close the prompt.
- Typing a shortcut changes the input mode: Language and IME shortcuts are handled by Windows and may vary with user settings. The user can check the language indicator or use the Windows input selector rather than assuming a universal toggle.
- Characters become question marks later: The InputBox may not be the source of the loss. Check the later storage or export path, such as a legacy text file encoding, a database connection, or code that converts text to a limited character set. Test the complete workflow with representative characters.
- The macro treats Cancel as blank: That is the VBA
InputBoxfunction’s return behavior. UseApplication.InputBoxwhen distinguishing its Boolean Cancel value from text is important.
For diagnosis, first try entering the same text into a normal worksheet cell or another Windows text field. If it fails there too, investigate the installed input method or Windows language settings. If the text works in other fields but not in the macro’s later processing, inspect the VBA code after the dialog closes and any systems that receive the value.
When a UserForm is a better choice
A custom VBA UserForm is more suitable when users need several fields, persistent instructions, buttons, or more control over text entry. A Microsoft Forms TextBox control has an IMEMode property on Windows. It can request a mode such as Hiragana or full-width alphanumeric input, rather than leaving every detail to the built-in InputBox.
For example, add a TextBox named TextBox1 to a UserForm, then use this initialization event:
Private Sub UserForm_Initialize()
' Request Hiragana mode for this Windows Forms TextBox.
Me.TextBox1.IMEMode = fmIMEModeHiragana
End Sub
The setting is a request about the control’s input mode, not a guarantee that every installed IME will behave identically. Choose a mode only when it suits the users and the expected text. For a multilingual audience, forcing one script can be confusing; leaving the mode under user control may be preferable. A UserForm can also validate the completed string after entry, which is separate from controlling composition.
On Mac, do not assume the Windows Microsoft Forms IME setting or its named modes are available or behave the same way. Users select input sources through macOS, and VBA UserForm control support differs from Windows. If the workbook must run on both platforms, test the form on each target platform or use a simpler text-entry design. Excel for the web does not run VBA macros.
Choosing a prompt for a multilingual workbook
Use the simplest input method that meets the task. A one-off name or short comment usually fits a built-in text InputBox. A structured workflow, multiple fields, clear cancellation behavior, or a Windows-specific request for an IME mode points toward a UserForm. If users may enter several languages, do not confuse choosing an IME with validating the data.
Useful design practices include:
- Write the prompt in a language the user understands and state what kind of response is needed.
- Tell users whether blank input is allowed and what to do if the desired characters do not appear.
- Handle Cancel separately when the chosen dialog permits it, and avoid silently treating cancellation as valid data.
- Test with real representative text, including punctuation and characters from the scripts users will enter.
- Check the value after it is written to cells and after any export or transfer to another system.
For example, a prompt that says “Enter the customer name in the form used by your records” is more useful than one that merely says “Name” if the workbook accepts multiple scripts. If a database requires a particular format, document and validate that requirement in the macro instead of expecting the InputBox or IME to enforce it.
Frequently Asked Questions
Can VBA InputBox accept Japanese or Chinese text?
Yes. The user can enter text through an active Windows IME, and the dialog returns the committed text. The IME must be available and selected, and the user must finish composition before submitting.
How do I turn on IME in a VBA InputBox?
The built-in VBA InputBox has no IME-on argument or language setting. Switch the Windows input method or mode before or while entering text. For a Windows UserForm TextBox, the IMEMode property offers more control, subject to the installed IME and platform.
Why does InputBox return an empty string when I click Cancel?
The VBA InputBox function returns an empty string for Cancel and for a submitted blank answer. Excel’s Application.InputBox returns Boolean False for Cancel, so it can distinguish cancellation from text input.
Does Application.InputBox automatically convert text to a number?
No. Its Type argument can request a numeric response, but it does not translate language or decide what a text entry means. Choose a type that fits the expected answer and handle cancellation and invalid responses.
Does this work in Excel for the web or on Mac?
Excel for the web cannot run VBA macros. Excel for Mac has VBA, but Windows-specific IME controls and UserForm behavior should not be assumed to work identically; test any cross-platform workbook on the target Mac and input source.
Related
- Excel Split Print Area Into Two Pages: Page Breaks
- Excel Split Contents of a Cell Into Two Cells
- Excel Split Multiline Cell Into Rows
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- VBA InputBox Cancel: Detecting Cancel and Blank RepliesIn VBA, the built-in InputBox function returns an empty string when the user clicks Cancel, but it also…
- Excel VBA: Display a Variable Value in a MsgBoxIn Excel VBA, display a variable in a message box by passing it to MsgBox, for example MsgBox…
- VBA Find: How to Handle a Failed SearchIn Excel VBA, handle a failed Range.Find search by checking whether its result is Nothing before using it.…
- Excel VBA UserForm Parameters: Pass and Return ValuesTo pass parameters to an Excel VBA UserForm, create an instance of the form, call a public setup…
- Excel VBA Select Case: Syntax and ExamplesIn Excel VBA, Select Case runs one block of code based on the value of an expression, making…
- Excel VBA: Find the Last Row With Data in a ColumnIn Excel VBA, the usual way to find the last occupied row in one column is to start…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.