+ Reply to Thread
Results 1 to 13 of 13

Change GetOpenFilename Default Location

  1. #1
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99

    Change GetOpenFilename Default Location

    When I use the GetOpenFilename() method, it seems to default to the particular users My Documents. Is there a way to force it to default elsewhere like a share drive, or the users desktop?

    In the same line of thought, if I have a file named TestFile.xls. and I want to try to open it from the users desktop if they have it, how can I do this, since their desktop location is different than mine?
    Last edited by VBA Noob; 10-29-2008 at 05:04 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    Ok, so i'd change with the changeDir, or ChDrive, but since everyones desktop has a different path naturally, is there a windows call that specifies the user desktop that would auto propagate the proper path?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I don't understand your question, but if you want to change to a UNC path, perhaps http://www.mrexcel.com/forum/showthread.php?t=4035

  5. #5
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    Quote Originally Posted by shg View Post
    I don't understand your question, but if you want to change to a UNC path, perhaps http://www.mrexcel.com/forum/showthread.php?t=4035
    I tried this, but it kept saying, "could not connect to /desktop

    Let me try to explain a little more detailed.

    When Calling the GetOpenFilename() method, the popup box for me at least ALWAYS defaults to the My Documents location
    My Documents location: \\dtcdat-txwl001\nwtx7965\My Documents\
    I want it to default to the users Desktop location
    My Desktop location: C:\Documents and Settings\nwtx7965\Desktop\

    I cannot set the path to C:\Documents and Settings\nwtx7965\Desktop because other users cannot access my desktop so the nwtx7965 changes for each user. I apologize but I'm not used to calling API functions and they aren't working for me the way I thought they would, perhaps its me that is making the problem with the example you said. I tried to search information on the API and still couldn't find the solution. Perhaps I've asked for the impossible, but if anything, I've come to discover you can do just about anything you want in Excel.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    So does it work for the one particular user if you do
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    Quote Originally Posted by shg View Post
    So does it work for the one particular user if you do
    Please Login or Register  to view this content.

    Yes it works for me if I do that, but not for any other user on their own pc's due to the location having a different nwtxid, based off of their username.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Do you have a list someplace?

  9. #9
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    Quote Originally Posted by shg View Post
    Do you have a list someplace?
    No, and it would be impractical as well. There are over 500 employeees this could be released too, over 11 different centers. Others have naming conventions different than my center, and every persons desktop is different, even my desktop at home is different as the nwtx would be replaced with Tirren, and the C:/ would be replaced with G:/ (don't ask, it wouldn't let me choose C for my main directory for some reason).

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    If you browse C:\Documents and Settings\, can you see all the users (those not on G)?

  11. #11
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    I cannot, the My documents, is a roaming profile, desktop is local only.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Outta ammo, Tirrent. I'll ask Leith Ross to take a look.

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Tirren,

    This macro uses the Windows API to display the system Open or Save dialog. It will open the directory you specify. This will work with Excel on Windows '95 up to '2003. It is untested on Excel 2007. Please do not attempt to change any part of this macro, unless you know exactly what you are doing. Load this into a standard VBA module.
    Please Login or Register  to view this content.
    Example
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1