title: How can I call ActivateKeyboardLayout from 64bit Windows Vista using VBA
body: <p>Running VBA under XP I was able to call ActivateKeyboardLayout to switch my input language from English to another language. However, this no longer works under Vista64.</p>
  
  <p>Any suggestions or workarounds?</p>
  
  <p>The code that used to work under XP was similar to the following:</p>
  
  <pre><code>Private Declare Function ActivateKeyboardLayout Lib "user32" ( _
      ByVal HKL As Long, ByVal flags As Integer) As Integer
  Const aklPUNJABI As Long = &amp;H4460446
  ActivateKeyboardLayout aklPUNJABI, 0
  </code></pre>
  
  <p>There was a suggestion to try </p>
  
  <pre><code>Public Declare Function ActivateKeyboardLayout Lib "user32" ( _
      ByVal nkl As IntPtr, ByVal Flags As uint) As Integer
  </code></pre>
  
  <p>When I try this I get the error message:</p>
  
  <p><strong>Variable uses an Automation type not supported in Visual Basic</strong></p>