I know alot of people strip filename by using loops. Use the third method will only require one line of code and no loops.

Code:
Sub Main()
  Dim str_Data As String
  str_Data = "C:\Visual Basic\Test.txt"

'Method1
'  Dim int_Last As Integer
'  Dim int_Pos As Integer
'  Do
'    int_Last = int_Pos
'    int_Pos = InStr(int_Pos + 1, str_Data, "\", vbTextCompare)
'    If int_Pos = 0 Then Exit Do
'  Loop
'
'  MsgBox Mid(str_Data, int_Last + 1)
  
'Method2
'  Dim int_X As Integer
'  For int_X = Len(str_Data) To 1 Step -1
'    If Mid(str_Data, int_X, 1) = "\" Then
'      MsgBox Mid(str_Data, int_X + 1)
'      Exit For
'    End If
'  Next
  
'Method3
  MsgBox Mid(str_Data, InStrRev(str_Data, "\") + 1)
End Sub





This tip replace five lines of code with one. Use Method 2 when dealing with booleans.

Code:
Private Sub Form_Click()
'  'Method1
'  If Command1.Visible = True Then
'    Command1.Visible = False
'  Else
'    Command1.Visible = True
'  End If

  'Method2
  Command1.Visible = Not Command1.Visible
End Sub