'********************************************************************************************************** ' Name: getFileName ' Author: mielk | 2014-02-26 ' ' Comment: Function returns the name and extension of the given full filepath. ' ' Parameters: ' filepath The path of a file which name is to be returned. ' ' Returns: ' String The name of the given file (including extension). ' If the given parameter is not a proper file path, an empty String is returned. ' ' ' --- Changes log ----------------------------------------------------------------------------------------- ' 2012-03-26 mielk Function created. '********************************************************************************************************** Public Function getFileName(filepath As String) As String Const METHOD_NAME As String = "getFileName" '------------------------------------------------------------------------------------------------------ Dim slashPosition As Integer '------------------------------------------------------------------------------------------------------ slashPosition = VBA.InStrRev(filepath, "\") getFileName = VBA.Mid(filepath, slashPosition + 1) End Function