GeoVron said:
want to locate a character position in a text string, i.e. want to know
what
position it is in the string ex// "1234 /CAIU456789" / would be the 7th
position. Is there
a Built In Function for this?
This will locate the position of a character in a string. If the character
exists more than once, it will give the position of the last occurrence.
Function RightInstr(strString As String, strCharacter As String)
'********************************************************************
' Name: RightInstr
' Purpose: Counts the position of the last occurence of a character in a
string
' Author: Arvin Meyer
' Date: 02/03/97
' Comment:
'********************************************************************
On Error GoTo Err_RightInstr
Dim intPos As Integer
intPos = Len(strString)
Do While intPos > 0
If InStr(intPos, strString, strCharacter) <> 0 Then
RightInstr = intPos
Exit Do
Else
intPos = intPos - 1
End If
Loop
Exit_RightInstr:
Exit Function
Err_RightInstr:
MsgBox Err.Description
Resume Exit_RightInstr
End Function