davidsperling
asked on
Environ("HOMEPATH") in Vista/Excel 2007
Code below will output:
sHome=\Users\myusername
sMyFolder=\Users\myusernam e\KALLE
\Users\myusername exists:False
\Users\myusername\KALLE exists:False
I know that both my home folder and "KALLE" exists. It used to work under windows 2000/Office 2000.
Is there a solution or workaround?
sHome=\Users\myusername
sMyFolder=\Users\myusernam
\Users\myusername exists:False
\Users\myusername\KALLE exists:False
I know that both my home folder and "KALLE" exists. It used to work under windows 2000/Office 2000.
Is there a solution or workaround?
Sub Testi()
Dim fso As New FileSystemObject
Dim sHome, sMyFolder As String
sHome = Environ("HOMEPATH")
sMyFolder = sHome & "\KALLE"
Debug.Print "sHome=" & sHome
Debug.Print "sMyFolder=" & sMyFolder
Debug.Print sHome & " exists:" & fso.FolderExists(sHome)
Debug.Print sMyFolder & " exists:" & fso.FolderExists(sHome)
End Sub
ASKER
That will return c:\users\myusername, but that's not correct at the company I'm working at!
The path should be \\domain.company.net\users \myusernam e\Document s
Is there a way to extract that path?
The path should be \\domain.company.net\users
Is there a way to extract that path?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nop, it doesn't :(
I presume they did before, still might be able to do something if we can get to \\domain.company.net\ somewhere i.e. the default outlook client?
Chris
Chris
ASKER
>>... still might be able to do something if we can get to \\domain.company.net\ somewhere i.e. the default outlook client?
Don't quite understand :)
Don't quite understand :)
if for exampel the default mail address will be fred@domain.company.net and teh mail client is outlook then it coul dbe possible to get teh prefix of \\domain.company.net from outlook and continue by adding the path. Basically if the necessary information can be reliably assembled from any other data, (i.e. 2 or more environment variable) then that will give us a prospective way to achive your needs.
Chris
Chris
ASKER
The answer is it's not possible!
Shame, sorry we couldn't help
Chris
Chris
Try:
sHome = Environ("userprofile")
instead of
sHome = Environ("HOMEPATH")
Regards,
chris_bottomley