Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Location
    Richmond, Virginia, USA
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Path for desktop in Windows 2000 (Access 2000/VBA)

    Hi,
    I have an application that process a data file that the user downloads to his/her desktop. The application was written to look for the file in C:WindowsDesktop. The PCs that this application is located on are being upgraded to Windows 2000 where the desktop location is Cocuments and Settings<user name>Desktop. Since this location varies depending on who has logged on, is there an API call or other way of determining the path of the desktop?

    Thanks,

    Vernon

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Path for desktop in Windows 2000 (Access 2000/VBA)

    If you have WSH (Windows Scripting Host) installed and active then

    path = CreateObject("WScript.shell").SpecialFolders("Desk top")

    will return the path to the active user's Desktop


    Andrew C

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Path for desktop in Windows 2000 (Access 2000/VBA)

    Besides Andrew' WSH object solution (which I like), you can also take advantage of the Windows environment varialbe named Userprofile. It returns the root folder for the user. So the desktop folder is:

    %userprofile%Desktop

    Word's hook into the environment is the Environ() function. Not sure what Access offers.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Path for desktop in Windows 2000 (Access 2000/VBA)

    Does the WShell object destroy itself after this call? It's very space-efficient, but I am so used to the old "Dim an object variable, Set it, and then Set it to Nothing" routine. Could this all be happening implicitly in your code and should not worry about it?

  5. #5
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Path for desktop in Windows 2000 (Access 2000/VBA)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Kevin

    Can you give me an example of how to use the <font color=red> %userprofile%Desktop </font color=red> to find the path to the Desktop folder. I tried to use it as is, and it gave me a syntax error.

    Thanks

    Wassim <img src=/S/compute.gif border=0 alt=compute width=40 height=20>
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Path for desktop in Windows 2000 (Access 2000/VBA)

    Sure.

    if fso.fileexists(Environ("UserProfile") & "DesktopWord.lnk") then bla bla bla
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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