title: How to handle "type mismatch" in VBA boolean/LongLong array?
body: <p>When trying to execute below code, I get the VBA error: type mismatch. Anyone know the cause (and solution? :-))</p>
  
  <p>I changed datatypes from Long to LongLong to be able to handle larger numbers. Before this the code (excerpt) was working fine.</p>
  
  <pre><code>Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hwnd As LongPtr) As LongPtr
  Private Declare PtrSafe Function GetDeviceCaps Lib "gdi32" (ByVal hDC As LongPtr, ByVal nIndex As Long) As Long
  Private Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hwnd As LongPtr, ByVal hDC As LongPtr) As Long
  
  Public Sub TestScreenResolution()
      Debug.Print ScreenResolution
  End Sub
  Private Function ScreenResolution() As Double
       Dim hDC As Long
       hDC = GetDC(0)
       ScreenResolution = GetDeviceCaps(hDC, 88)
       ReleaseDC 0, hDC
  End Function
  
  Public Sub TestMySub()
      Call MySub(999999999)
  End Sub
  Private Sub MySub(ByVal x As LongLong)
  
  Dim y As LongLong
  Dim Max As LongLong
  Dim Min As LongLong
  
  Max = x * x
  Min = (x - 1) * (x - 1)
  
  Dim Arr() As Boolean   'Default Boolean type is False
  ReDim Arr(Min To Max) ''&lt;&lt;&lt; "Type Mismatch" compile error
  
  For y = Max To Min Step -2
      Arr(y) = True
  Next y
  
  End Sub
  </code></pre>
  
  <p>Of course this code is leading to nothing, just for testing this piece of code.</p>