i tried a lot to get rid of the errors but i could'nt
please help me ' the error its giving is 'type missmatch'

Private Sub cmdFindNext_Click()
On Error GoTo error_handler
Dim position As long
Dim str1 As String
Dim str2 As String

str1 = frmEDITOR.rtbEditor.Text ' main form's text box(richtext box)
str2 = txtfind.Text 'just a text box

If chkMcase = vbChecked Then
position = InStr(str1, str2, vbBinaryCompare)
Else
position = InStr(str1, str2, vbTextCompare)

End If

Exit Sub

error_handler:
MsgBox Err.Description
End Sub