How to get the extension of a file name in VB6

Description

Here is a visual basic function which returns the extension of any filename. This might be very helpful in scanning for a specific type of file like mp3, jpg or whatever may be. You can make this function private or public as needed for your use

Code:

 

Usage:

1 comment

  1. FileName$ = “WHATEVER.TXT” & “.”
    MyArray = Split(FileName$, “.”)
    FileExt$ = MyArray(UBound(MyArray) – 1)

    🙂

    Cheers,
    Kevin

Leave a Reply

Your email address will not be published. Required fields are marked *