Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Location of user profile folders (97sr2)

    I am building a small macro for use in applications testing, that will allow for easy recording of defects.
    I am stumped in one aspect however.

    On the client test machines I will have several users operating, and I want to be able to record user specific information so that it will persist for each user on subsequent logins on the test machine.
    I thought that adding a ini file to the winnt/profiles/user_logon_id/ folder tree would be an easy way to do this, however I cannot remember how to identify the user folders programmatically. That is how can I return a string that contains the path to the user folders in c:winntprofiles ??

    Can anyone help me out please.

    BTW - I cannot use the registry for this information due to corporate policies....

  2. #2
    Star Lounger
    Join Date
    Jan 2001
    Location
    U.S. - East Coast
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Location of user profile folders (97sr2)

    Have you looked at the environment variables that are available under NT? I forget which ones may be specific to NT, but "USERPROFILE", or some such variant, should be available. Then, you can use the function "ENVIRON()" to return the value stored in the variable.

    To see all the environment variables available, create a simple "For...Next" loop -- using an index, not an object reference, i.e.

    Dim i as Integer

    For i = 1 to 200 'arbitrary limit; can't retrieve actual limit from VBA
    Debug.Print Environ(i)
    Next i

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Location of user profile folders (97sr2)

    Even easier you can display a command window and type SET. This gives a list of all the environment variables, including USERPROFILE

    StuartR

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Location of user profile folders (97sr2)

    Ethan and Stuart,

    Thanks, that is exactly what I was after.

    Function UserProfilePath() As String
    UserProfilePath = Environ("USERPROFILE")
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •