locked
How to turn IME ON or OFF with vba? RRS feed

  • Question

  • Hi,

    Before showing an inputbox, how can I turn IME on or off in vba for microsoft access?

    Thank you.

    Wednesday, January 30, 2019 1:03 AM

All replies

  • Hi,

    What is IME?

    Wednesday, January 30, 2019 3:47 PM
  • That's it. I'm looking for a way to turn it ON/OFF via vba.
    Thursday, January 31, 2019 1:12 AM
  • Hi,

    What is IME?

    It is keyboard input method.

    Every textbox on a form or a table can be set to make IME on or off when activated through its property sheet.

    http://www.kkkotobuki.co.jp/downloads/1.jpg

    I need to be able to turn it OFF or On for inputbox too.

    The following code works in microsoft Excel. But not in Access.
    I'm looking for something that works in Microsoft Access.

    Public Declare Function ImmGetContext Lib "imm32.dll" (ByVal hwnd As Long) As Long 
    Public Declare Function ImmReleaseContext Lib "imm32.dll" (ByVal hwnd As Long, _
    ByVal himc As Long) As Long 
    Public Declare Function ImmSetOpenStatus Lib "imm32.dll" (ByVal himc As Long, _
    ByVal b As Long) As Long 
    
    
    Sub IMEControl2()
     Dim hImc As Long
     Dim myHWnd As Long
     Dim Ret As String
      'Check Version
      If Application.Version > 9 Then
      myHWnd = Application.hWnd
      Else
      myHWnd = FindWindow("XLMAIN", 0)
      End If
      hImc = ImmGetContext(myHWnd)
      'IME OFF
      If hImc <> 0 Then
      Call ImmSetOpenStatus(hImc, 0)
      Call ImmReleaseContext(myHWnd, hImc)
      End If
      Ret = Application.InputBox("Type.", Type:=2)
      If Ret <> "" Then
        MsgBox "IME-OFF with API :" & Ret
      End If



    • Edited by h-gh Thursday, January 31, 2019 1:17 AM
    Thursday, January 31, 2019 1:14 AM
  • That's it. I'm looking for a way to turn it ON/OFF via vba.

    Hi h-gh,

    In A2003 (and I suppose also in newer versions) a Textbox control has several properties concerning IME.

    With VBA you can loop through all the (Textbox) controls and set these properties accordingly.

    Imb.

    Thursday, January 31, 2019 6:01 AM
  • That's it. I'm looking for a way to turn it ON/OFF via vba.

    Hi h-gh,

    In A2003 (and I suppose also in newer versions) a Textbox control has several properties concerning IME.

    With VBA you can loop through all the (Textbox) controls and set these properties accordingly.

    Imb.

    Thanks for replying. But I'm talking about inputbox not textbox.
    Thursday, January 31, 2019 7:39 AM
  • But I'm talking about inputbox not textbox.

    Hi h-gh,

    Oke, I missed that,

    You could make your own Input function using a small form with only one Textbox. Then you have all the flexibility to use that function.

    Imb.

    Thursday, January 31, 2019 7:50 AM