Get the Full Path of a File
This is a very simple way to get just the full directory path of a file passed in.
Public Function GetTheFilePath(ByVal strFile) As String
Files = Split(strFile, "\")
For I = 0 to (UBound(Files) - 1)
FilePath = FilePath & Files(I) & "\"
Next
GetTheFilePath = FilePath
End Function
Usage
MyFilePath = GetTheFilePath("C:\testing\jim\file.txt")
will return:
C:\testing\jim\
Special Instructions
This code originally appeared on AndreaVB.com, and has been republished here with the permission of Andrea Tincani.
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.