title: Updating VBA API to 64-bit Excel 2013
body: <p>this is a shortcut API that allows you to access directly to the name box in Excel. Since I've changed to a 64-bit version I cannot make it to work. The error displayed is Type mismatch.</p>
  
  <pre><code>Private Declare PtrSafe Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
  Private Declare PtrSafe Function FindWindowEx Lib "USER32" Alias "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
  Public Declare PtrSafe Function SendMessageA Lib "USER32" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr
  
  Private Sub NameBox_Shortcut()
  
  Dim hWnd As LongLong
  
  Const NUL = vbNullString
  Const EXCEL_WINDOW = "XLMAIN"
  Const FORMULABAR_LEFT_HALF = "EXCEL;"
  Const NAMEBOX = "COMBOBOX"
  Const WM_LBUTTONDOWN = &amp;H201
  Const WM_LBUTTONUP = &amp;H202
  
  hWnd = FindWindowEx(FindWindowEx(FindWindow(EXCEL_WINDOW, NUL), 0, FORMULABAR_LEFT_HALF, NUL), 0, NAMEBOX, NUL)
  SendMessageA hwnd, WM_LBUTTONDOWN, 0&amp;, 0&amp;
  SendMessageA hwnd, WM_LBUTTONUP, 0&amp;, 0&amp;
  
  End Sub
  </code></pre>
  
  <p>Edit: Updated the code.</p>