954,190 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Assigning Drive Letter in VB6

Is there a method that VB uses to get the drive letter of the directory where the program files reside witout specifying it explicitly? :rolleyes:

PaulCC
Newbie Poster
2 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

If I understand correctly. You can use the stored system variables:

Debug.Print Environ("PROGRAMFILES")

'OR if you want just the drive letter you can also use

Debug.Print Environ("HOMEDRIVE")

'OR

Debug.Print Environ("SYSTEMDRIVE")



Find a large list of these variables here and what they are all about: http://vlaurie.com/computers2/Articles/environment.htm

Sentax
Newbie Poster
18 posts since Nov 2006
Reputation Points: 10
Solved Threads: 2
 

The path where the project file resides can be gotten (as a string) using App.Path

PaulCC
Newbie Poster
2 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

Hi,

Use

MsgBox "My program Is In drive : " & Left(App.Path,1)

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You