Results 1 to 3 of 3

Thread: Folder Search Location Using VB
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Sep 2007
    Location
    Seattle
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Folder Search Location Using VB

    I have several macros that use code like this:

    strFileOpenName = Application.GetOpenFilename("Text Files (*.txt),*.txt", 1, "Find F850 Text File", , False)

    When invoked the user is prompted to open a file in the path that has been set up in the "File Save" option. I don't want to change the default file save path but I do want to be able to set a different search location when this line of code runs. The dafualt file open location may be "C:\Excel\Files." In this macro I want the user to see files in "C:\Macro\Files." How do I change/add to this code to accompish that?

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Folder Search Location Using VB

    You can use ChDir to change the current active directory, which will be used when the GetOpenFileName is executed.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    New Member
    Join Date
    Sep 2007
    Location
    Seattle
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Folder Search Location Using VB

    Gracias Amigo!
    Don't you like one or two easy ones now and then?

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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