Why the program doesn't work(編號:1963)

There is a problem with a following code, when the main sub calls the
function Same. The program works if using Flagsame=Same(1,2), but
the program does not work if using m1=1, m2=2, Flagsame=Same(m1,m2),
with a Compile Error: "ByRef argument type mismatch". I do not know why.
How to revise the code to use the way like Flagsame=Same(m1,m2)? Thanks.
-----
Option Explicit
Dim x(4), y(4) As Integer
Dim m1, m2 As Integer
Private Function Same(p1 As Integer, p2 As Integer) As Boolean
Dim dx As Integer
dx = x(p2) - x(p1)
If dx > 0 Then
Same = -1
Else
Same = 0
End If
End Function
Private Sub Command1_Click()
Dim Flagsame As Boolean
x(1) = 1000
y(1) = 1000
x(2) = 2000
y(2) = 4000
m1 = 1
 m2 = 2
 
 'Flagsame = Same(1, 2)  'using this statement, the program works.
 Flagsame = Same(m1, m2)  'Using this one, get Compile Error: "ByRef argument type
mismatch."
If (Flagsame) Then
  Picture1.Line (x(m1), y(m1))-(x(m2), y(m2))
 End If

End Sub