VBA compiler compiling errors

I got a compiling error with the following code:

Dim XS2RunList() as long

How can I get the VBA Compiler work with dynamic array?

I also got compiling error with other misc. constants ie vbYesNo, vbCrLf, xlNone, xlContinuous, xlInterrupt,xlErrorHandler

How can I get around them?

Dynamic arrays use a different convention. Here is a basic sample:

Sub MyProtectedSub(Param1)

' Create a dynamic array
DIM PTIM = VarArrayCreate([0,3000,0,5], 12)

' Assign a value:
PTIM[1,2] = 1530

'Show the value:
MsgBox (PTIM[1,2])
End Sub

For the unknown constants, we’re checking why they are not recognized.

Thanks for replying.

What’s does the number 12 in the vararraycreate function mean?

It’s an internal parameter. Always use 12.

It works. Thank you.