VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get a file extension

by Anonymous (267 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Mon 28th December 1998
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get a file extension

Rate Get a file extension



' FUNCTION: Extension
'
' Extracts the extension portion of a file/path name
'
' IN: [strFilename] - file/path to get the extension of
'
' Returns: The extension if one exists, else vbnullstring

'
Function Extension(ByVal strFilename As String) As String
    Dim intPos As Integer

    Extension = vbNullString

    intPos = Len(strFilename)

    Do While intPos > 0
        Select Case Mid$(strFilename, intPos, 1)
            Case "."
                Extension = Mid$(strFilename, intPos + 1)
                Exit Do
            Case Else
        End Select

        intPos = intPos - 1
    Loop


Download this snippet    Add to My Saved Code

Get a file extension Comments

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

Post your comment

Subject:
Message:
0/1000 characters