VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Retrieve file extension only from a file

by C.J. (13 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sat 2nd January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Retrieve file extension only from a file

Rate Retrieve file extension only from a file



'parses extension from filename and returns the extension
'no extension is sent back as """"

    Dim nPosition As Integer
    
    If InStr(1, lpFileName, ".") < 1 Then
     Exit Function
     Else
        nPosition = InStr(1, lpFileName, ".")
        GetExtension = Mid$(lpFileName, _
            nPosition, _
            Len(lpFileName) - (nPosition - 1))
    End If
End Function

Download this snippet    Add to My Saved Code

Retrieve file extension only from a file Comments

No comments have been posted about Retrieve file extension only from a file. Why not be the first to post a comment about Retrieve file extension only from a file.

Post your comment

Subject:
Message:
0/1000 characters