Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2002
    Location
    London
    Posts
    73

    Unanswered: Saving xls document from Access on Desktop

    Hi, just having trouble with saving an excel document on the desktop in Windows XP. As different users log in you cannot select the path see below with the username highlighted

    C:\Documents and Settings\username\Desktop\

    Is there a way in VBA where it just saves it on the desktop just for that user?

    Thank you in advanced

  2. #2
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Try this link for an example of using a Windows API to get the Windows user name so you can put this file on their desktop.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If you only want the username then
    Code:
    Environ("Username")
    *should* suffice
    George
    Home | Blog

  4. #4
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Thanks George. The Environ is so much easier than an API.

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I wouldn't normally recommend it's use but for this it is perfectly acceptable
    It was on the top of my head because I implemented a really similar thing into my latest project : who knew!

    How are you nowadays anyway Mr Rauch?
    George
    Home | Blog

  6. #6
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    I'm fine, just working more than usual, which of course is good because that means I'm making more money!

    Why would you not recommend it's use normally? Is there something wrong with Environ?

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    The only time this is really discussed is when people want to use Environ as part (or a whole) of the security of their application. The short answer is; Environ can be easily faked and so should not be used as security.

    For this purpose it is perfectly acceptable as long as you have error handling in place - if environ returns blank or is faked the folder will not exist.

    I dunno, ever since the whole security issues thing I have held back on implementing environ.

    More money (sometimes) = More fun
    George
    Home | Blog

  8. #8
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    More money = more responsibility But that is a good thing.

Posting Permissions

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