Tools Links Login

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\

About this post

Posted: 2019-08-24
By: JimAndrews
Viewed: 266 times

Categories

Visual Basic 6

Attachments

No attachments for this post

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.