| Public Function FileNameOnly(strPathName As String) As String ' Purpose: Convert a string from a fully qualified path to a file name. ' In: strPathName - The fully qualified path ' Out: None Dim lngIndex As Long ' Backslash character positon Dim strRemnant As Variant ' What remains after trimming off ' everything to the left of the last backslash character. strRemnant = strPathName Do lngIndex = InStr(strRemnant, "\") If lngIndex = 0 Then Exit Do ' There are no more backslash characters: we have the name. strRemnant = Right$(strRemnant, Len(strRemnant) - lngIndex) Loop FileNameOnly = strRemnant ' Sock it to me! End Function |
Very efficient way to return a file name from a fu |
Express News India | Freelance ecommerce web development India