Return a Full Path Given SubFolder or SubFolder/Filename Only

Category:
Files and Directories
Type:
Snippets
Difficulty:
Beginning
Author:
m.posseth

Version Compatibility: Visual Basic 6

More information:
This snippet returns a full path given the subfolder or the subfolder plus file name. For example, datadrive("DATA\Test.mdb") returns "X:\DATA\Test.mdb" where X = the drive letter. This is useful for finding your appliication on a machine where you don't know where it is installed, or for finding the CD-ROM drive if your program has some files that run off of it.

This code is Pure M. Posseth code but I make it public domain with this publication, use it as you will, no need to name me (would be appreciated if you did) free to distribute or modify with only one restriction: if you can improve it with the same functionality you must sent me the Code.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: