Search This Blog

Get the Filename and the extension of Filename Visual Basic 6.0


Public Function getextension(filename As String) As String

For i = Len(filename) To 2 Step -1
  c = Mid(filename, i, 1)
  If c = "." Then
  pos = i + 1
  End If
Next

getextension = Mid(filename, pos, (Len(filename) + 1 - pos))
End Function


'Function to get filetitle from full path


Public Function getfiletitle(filename As String) As String

For i = Len(filename) To 2 Step -1
  c = Mid(filename, i, 1)
  If c = "\" Then
  pos = i + 1
  End If
Next

getfiletitle = Mid(filename, pos, (Len(filename) + 1 - pos))
End Function