+ Reply to Thread
Results 1 to 3 of 3

GetOpenFileName help

  1. #1
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    GetOpenFileName help

    Is there a way to designate the starting directory for GetOpenFileName ?
    The online VBA help only says you can designate a File Filter.

    TIA

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

    Use the VBA command ChDir to set the default directory. Specifiy the disk and path you want as a string.

    Example:
    The current directory setting is C:\My Documents

    This will change the default directory for Windows to...
    ChDir("D:\My Files\Excel Programs")

    Hope this answers your question,
    Leith Ross

  3. #3
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    GetOpenFileName help

    Thank Leith that was exactly what I was looking for.

    I added an
    On Error Resume Next
    line just before the ChDir command line that ends up taking you to the last directory used if the directory specified in ChDir is not avalialbe (i.e. a network drive that is no longer valid).
    Does anyone know if I may be setting myself up for trouble by using the
    On Error Resume Next
    in this way?

    Thanks again

+ 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