The %programfiles% variable at the DOS level will give you the program files directory. If your dealing with an x64 Windows Operating system you also want to look for an x86 Program Files directory.
Dim i as Integer
Text1.Text = ""
i = 1
While Environ$(i) <> ""
Text1.Text = Text1.Text + Mid(Environ$(i), 1, InStr(1, Environ(i), "=") - 1) + vbNewLine
i = i + 1
Provides the environment variables on a particular system.
To actually assign an environment variable to a variable in your application you would use:
dim strProgramFile as string
strProgramFile = Environ(”ProgramFiles”)
Here is a link that tells another technique to use: http://vbtechniques.com/content.asp?a=co&cID=624