0

Access Msgbox does not support Unicode character. I use MessageBoxW to simulate Msgbox and it works perfectly.

Private Declare PtrSafe Function MessageBoxW Lib "User32" (ByVal hWnd As LongPtr, ByVal lpText As LongPtr, ByVal lpCaption As LongPtr, ByVal uType As Long) As Long

Public Function MsgBoxW(Prompt As String, Optional Buttons As VbMsgBoxStyle = vbOKOnly, Optional Title As String = "Microsoft Access") As VbMsgBoxResult
    Prompt = Prompt & vbNullChar 'Add null terminators
    Title = Title & vbNullChar
    MsgBoxW = MessageBoxW(Application.hWndAccessApp, StrPtr(Prompt), StrPtr(Title), Buttons)
End Function

MsgBox display information and provides preset buttons for user selection. InputBox allows user to enter string.

Do not know which function I can use to simulate InputBox to support Unicode character data entering. Thanks.

YellowLarry
  • 367
  • 1
  • 4
  • 16
  • Does this answer your question? [How do I display a messagebox with unicode characters in VBA?](https://stackoverflow.com/questions/55210315/how-do-i-display-a-messagebox-with-unicode-characters-in-vba) – June7 Jan 18 '20 at 23:52
  • It is for MsgBox which I use now. I need equivalent function of InputBox to enter Unicode character. – YellowLarry Jan 19 '20 at 01:58

1 Answers1

0

Never thought about it, but my InputMox (and MsgMox) seems to support Unicode.

Too much code to list here, but full code is on GitHub: VBA.ModernBox

Test

Using the code:

MsgMox InputMox("Enter Unicode", "Unicode Test", ChrW(453)), vbInformation + vbOKOnly, "Unicode Test"

enter image description here

enter image description here

Gustav
  • 48,886
  • 6
  • 31
  • 51
  • They don't, at least not on any system I tried. They do support all characters in your current code page, so to test it you need to use `ChrW` to try to display a character outside your code page. – Erik A Jan 19 '20 at 09:21
  • @ErikA: That's what I did. See examples, please. – Gustav Jan 19 '20 at 11:56
  • I mean, the classic ones, not yours, yours are fine just a very different style – Erik A Jan 19 '20 at 15:05
  • Copied code and it seems work. Need to figure out how to setup ModernBox and ModputBox forms. – YellowLarry Jan 19 '20 at 15:05
  • @YellowLarry: No "setup" is needed. The two functions are direct replacements for their VBA ancestors. – Gustav Jan 19 '20 at 16:15