Using .Net or Getting User folder

JaedenRuiner

Registered User.
Local time
Today, 13:44
Joined
Jun 22, 2005
Messages
154
Okay,

I've looked all over the place and found System.Environment.GetFolderPath() as a .Net solution to finding the user folder and other special folders, which is exactly what I need. I would like a way to request from the system the path to the My Documents folder or other such personal folder for the current non-roaming user. However, I cannot seem to either:
  1. Find a function that returns the current non-roaming user's folder
  2. incorporate the .NET System Namespace into a VBA module to provide me with the already existent functionality.

So, without running in circles, how can I find, specifically the user's personal folder path from VBA in Excel, Access, Word, etc:

IE: C:\Documents and Settings\[Current User]\My Documents

thanks

Jaeden "Sifo Dyas" al'Raec Ruiner
 
Haven't tried what you're asking but I get the username this way.

Add to references:Microsoft Scripting Runtime
Dim objNetwork
Set objNetwork = CreateObject("wscript.network")
strUser = objNetwork.UserName

You could build your path using the strUser variable.
Does that make sense?
 

Users who are viewing this thread

Back
Top Bottom