Firstly apologies for this extremely vague post. We have a macro that is very old, was built by someone who has since left the organisation and it is unfortunately beyond my capabilities. It takes in various csv files and creates notepad outputs.
We are upgrading to 365 and it fails. It is breaking on the VarPtr(pPrim) below due to a Type Mismatch:
Dim pPrim As tPrim
Public Sub initLoad()
DataCopy String(Len(pPrim) / 2, " "), VarPtr(pPrim)
End Sub
tPrim relates to this:
Private Type tPrim
WS_PRIM_I_SEC(31) As Byte
Filler1(19) As Byte
WS_PRIM_I_CUSIP(17) As Byte
Filler2(19) As Byte
WS_PRIM_I_SYM(31) As Byte
Filler3(19) As Byte
WS_PRIM_I_NAV(37) As Byte ' 12N6
Filler4(19) As Byte
WS_PRIM_I_SRC(15) As Byte
Filler5(19) As Byte
WS_PRIM_I_STA(15) As Byte
FILLER6(1) As Byte
WS_PRIM_I_UFLAG(9) As Byte
FILLER7(7) As Byte
WS_PRIM_I_COB_DT(19) As Byte
FILLER8(19) As Byte
WS_PRIM_I_DIV(35) As Byte
FILLER9(19) As Byte
WS_PRIM_I_DIV_DT(19) As Byte
FILLER10(19) As Byte
WS_PRIM_I_DIV_DIST(7) As Byte
FILLER11(19) As Byte
WS_PRIM_I_CDIV(35) As Byte
FILLER12(999) As Byte
End Type
I honestly don't know if there is enough information here to enable anyone to help, but there is a huge amount of code in the workbook so it's difficult to post it all.
Addition
The code relating to DataCopy is:
Private Sub DataCopy(value$, toMem&)
Dim myBuff() As Byte
If value = "" Then Exit Sub
myBuff = value
CopyMemory ByVal toMem, myBuff(0), UBound(myBuff) + 1
End Sub