none
Searching for Current User Path with VBA RRS feed

  • Question

  • For my Access project, I need to copy a file to the current user path, how can I use VBA to locate the path ?

    Kindly advise.

    Thank you.

     


    TS Lim
    Saturday, September 24, 2011 2:53 PM

Answers

  • Hi TS Lim,

     

    You might try using the Environ() Function to locate the current user profile, for example:

    Environ("USERPROFILE") + "\My Documents"
    

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    • Marked as answer by TS Lim Saturday, September 24, 2011 11:04 PM
    Saturday, September 24, 2011 3:11 PM

All replies

  • Hi TS Lim,

     

    You might try using the Environ() Function to locate the current user profile, for example:

    Environ("USERPROFILE") + "\My Documents"
    

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    • Marked as answer by TS Lim Saturday, September 24, 2011 11:04 PM
    Saturday, September 24, 2011 3:11 PM
  • Yo can use environ() function with all the PC envirnomental variables.  to get a list of the variable to the following

    1) From Start button : Select RUN

    2) Type in the box : CMD.  If this doesn't work the Browse for CMD in the windows folder C:\WINDOWS\system32\CMD.Exe

    3) Enter into DOS Prompt : SET Return


    jdweng
    Saturday, September 24, 2011 3:57 PM
  • Depending on what you mean by current path, you might want to look at the CurDir function.
    Saturday, September 24, 2011 8:47 PM
  • Hi Danishani,

    This resolve my problem.

    Thank you.

     


    TS Lim
    Saturday, September 24, 2011 11:04 PM
  • Hi Marshall,

    Thank you for your reply. The current user path I mean is the path of the user-profile. Danishani has provided me the solutiton. Thank you anyway.

     


    TS Lim
    Saturday, September 24, 2011 11:17 PM