Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90140

Vba bitness migration - Type Mismatch on "-" operator

$
0
0

We have recently begun migrating to Office 365. First day after migration, a user reported a problem with the following piece of VBA code, using the kernel32.dll library:

'@Esposed
'@Folder System.Text
Option Explicit

Private Declare PtrSafe Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Byaval dst As Long, ByVal src As Long, ByVal length as Long) 

Private Const DEFAULT_CHARACTER_CAPACITY As Long = &H10
Pivate CurrentByteLength As Long
Private StringBuffer() As Byte

Private Sub Class_Initialize() 
    ReDim StringBuffer(0 To (DEFAULT_CHARACTER_CAPACITY * 2) - 1) 
                                                            '^ Type Mismatch!!!                             

End Sub

It turns out that our previous version of Office(2016) was 32bit, so we ended up with 2 migrations in one.

I have tried changing all the Long references to LongPtr, and converting all the constants using the CLngPtr function, with no success. Any idea on what is going on here?


Viewing all articles
Browse latest Browse all 90140

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>