1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

GUI for user to specify a new directory?

Discussion in 'VBA Macros' started by ErikG, Jan 11, 2018.

  1. ErikG

    ErikG New Member

    Messages:
    2
    Hi All!

    Just like the Application.GetSaveAsFilename() method allows users to specify an excel file that does not yet exist through a GUI dialog (It returns a string with the path and filename that the code then creates by saving a file), I would like to offer users a similar GUI/dialog to to specify a directory (that may not yet exist) that would receive output from several different sub-routines.

    I tried the GetSaveAsFilename method but it would not let me specify a directory and Application.FileDialog limited me to existing directories. Does anyone know of a way to generate this functionality?

    Many thanks in advance!!

    Erik G
    ThrottleWorks likes this.
  2. Marc L

    Marc L Excel Ninja

    Messages:
    3,340
    Hi !​
    Code (vb):
    Sub DemoFolder()
        Dim obj As Object, P$
        Set obj = CreateObject("Shell.Application").BrowseForFolder(0, vbLf & "Sélection :", 1, "")
         If obj Is Nothing Then Beep: Exit Sub Else P = obj.Self.Path & "\": Set obj = Nothing
        MsgBox P
    End Sub
    Do you like it ? So thanks to click on bottom right Like !
    ErikG likes this.
  3. ErikG

    ErikG New Member

    Messages:
    2
    Works great!! Thanks so much!!

Share This Page