Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Select folder dialog box

Discussion in 'Information Technology' started by Robert Fonda, Jul 28, 2006.

  1. Robert Fonda

    Robert Fonda
    Expand Collapse
    Guest

    I would like to call the standard windows Folder Selection dialog box. The
    open/save dialog box doesn't seem to offer me this option. Any ideas? I just
    want the user to be able to browse folders, then select one, and return the
    folder name and path to my code.

    Thoughts/suggestions/insults?
     
  2. Loading...


  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    See http://www.mvps.org/access/api/api0002.htm at "The Access Web"

    Oh yeah, that's an ugly shirt you're wearing. (you said you wanted insults!)
    <g>

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Robert Fonda" <RobertFonda@discussions.microsoft.com> wrote in message
    news:DFEE0FE2-4855-4339-A18A-8A176038A172@microsoft.com...
    > I would like to call the standard windows Folder Selection dialog box. The
    > open/save dialog box doesn't seem to offer me this option. Any ideas? I

    just
    > want the user to be able to browse folders, then select one, and return

    the
    > folder name and path to my code.
    >
    > Thoughts/suggestions/insults?
     
  4. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Re: Select folder dialog box -- BrowseFolder, GetOpenFileName

    Hi Robert,

    here is a link to the BrowseFolder Dialog written by Terry
    Kreft

    http://www.mvps.org/access/api/api0002.htm

    If the folder that is being chosen will have a file in it, I
    like to use the OpenFile dialog and instruct them to pick a
    file in the folder that they want since the function to
    choose a folder always starts you at the root of the drive.
    Then I parse the filename out of what is returned and just
    store the path

    In the code to open a file, you can specify a start directory

    Call the standard Windows File Open/Save dialog box by
    Ken Getz

    http://www.mvps.org/access/api/api0001.htm



    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Robert Fonda wrote:
    > I would like to call the standard windows Folder Selection dialog box. The
    > open/save dialog box doesn't seem to offer me this option. Any ideas? I just
    > want the user to be able to browse folders, then select one, and return the
    > folder name and path to my code.
    >
    > Thoughts/suggestions/insults?
     
  5. Robert Fonda

    Robert Fonda
    Expand Collapse
    Guest

    > Oh yeah, that's an ugly shirt you're wearing. (you said you wanted insults!)

    I can't help it, my mom dresses (and I'm 43).
    "Douglas J Steele" wrote:

    > See http://www.mvps.org/access/api/api0002.htm at "The Access Web"
    >


    I am currently using that code for my FILE open/save dialog. What I need is
    to simply select a folder, not the file. I must be missing something here. I
    could build one with fileattrib(), but that would be a pain.
     
  6. Robert Fonda

    Robert Fonda
    Expand Collapse
    Guest

    Re: Select folder dialog box -- BrowseFolder, GetOpenFileName

    Yeah, parsing the filename out is trivial, guess I'll just do that.

    Thanks all!

    "strive4peace" <"strive4peace2006 at yaho" wrote:

    > Hi Robert,
    >
    > here is a link to the BrowseFolder Dialog written by Terry
    > Kreft
    >
    > http://www.mvps.org/access/api/api0002.htm
    >
    > If the folder that is being chosen will have a file in it, I
    > like to use the OpenFile dialog and instruct them to pick a
    > file in the folder that they want since the function to
    > choose a folder always starts you at the root of the drive.
    > Then I parse the filename out of what is returned and just
    > store the path
    >
    > In the code to open a file, you can specify a start directory
    >
    > Call the standard Windows File Open/Save dialog box by
    > Ken Getz
    >
    > http://www.mvps.org/access/api/api0001.htm
    >
    >
    >
    > Warm Regards,
    > Crystal
    > Microsoft Access MVP 2006
    >
    > *
    > Have an awesome day ;)
    >
    > remote programming and training
    > strive4peace2006 at yahoo.com
    >
    > *
    >
    > Robert Fonda wrote:
    > > I would like to call the standard windows Folder Selection dialog box. The
    > > open/save dialog box doesn't seem to offer me this option. Any ideas? I just
    > > want the user to be able to browse folders, then select one, and return the
    > > folder name and path to my code.
    > >
    > > Thoughts/suggestions/insults?

    >
     
  7. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    The code for the standard Windows File Open/Save dialog is
    http://www.mvps.org/access/api/api0001.htm

    I'm pointing you to http://www.mvps.org/access/api/api0002.htm, which is the
    standard Windows BrowseFolder dialog.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Robert Fonda" <RobertFonda@discussions.microsoft.com> wrote in message
    news:E44A7966-F878-465E-9E91-B52826DA42B8@microsoft.com...
    > > Oh yeah, that's an ugly shirt you're wearing. (you said you wanted

    insults!)
    >
    > I can't help it, my mom dresses (and I'm 43).
    > "Douglas J Steele" wrote:
    >
    > > See http://www.mvps.org/access/api/api0002.htm at "The Access Web"
    > >

    >
    > I am currently using that code for my FILE open/save dialog. What I need

    is
    > to simply select a folder, not the file. I must be missing something here.

    I
    > could build one with fileattrib(), but that would be a pain.
     
  8. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Re: Select folder dialog box -- BrowseFolder, GetOpenFileName

    Hi Robert,

    to parse the filename, you can do this:

    '~~~~~~~~~~~~~~
    Dim mPath As String, mFile As String
    mPath = GetOpenFile("Pick an file in the Directory for
    Excel Export Path", "*.*")
    If Len(mPath) > 0 Then
    mFile = Dir(mPath)
    mPath = Left(mPath, Len(mPath) - Len(mFile))
    Me.ExportPath = mPath
    End If
    '~~~~~~~~~~~~~~

    to make it easier to call Ken's code, I wrote a general
    function -- this goes in a general module

    '------------------------------ BrowseFile
    Function BrowseFile( _
    pTitle As String, _
    Optional pFilter As String, _
    Optional pInitialDir As String) _
    As String

    'CALLS -->
    'ahtCommonFileOpenSave

    On Error GoTo Proc_Err

    Dim mFilename As String

    mFilename = Nz(ahtCommonFileOpenSave( _
    ahtOFN_FILEMUSTEXIST Or _
    ahtOFN_HIDEREADONLY Or _
    ahtOFN_NOCHANGEDIR, _
    IIf(IsMissing(pInitialDir), _
    CurrentProject.Path, pInitialDir), _
    pFilter, _
    , , , pTitle, , True))

    If Len(mFilename) = 0 Then Exit Function

    On Error Resume Next

    BrowseFile = mFilename

    Proc_Exit:
    Exit Function

    Proc_Err:
    MsgBox Err.Description, , _
    "ERROR " & Err.Number & " BrowseFile"
    'comment out next line after debugged
    Stop: Resume
    Resume Proc_Exit

    End Function

    '~~~~~~~~~~~~~~~~~~~~

    you can also use his Function GetOpenFile, which takes
    varDirectory and varTitleForDialog as parameters.
    Sometimes, I want to send a filter, which is why I made a
    seperate BrowseFile function in my databases

    '~~~~~~~~~~~~~~~~~~~~

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Robert Fonda wrote:
    > Yeah, parsing the filename out is trivial, guess I'll just do that.
    >
    > Thanks all!
    >
    > "strive4peace" <"strive4peace2006 at yaho" wrote:
    >
    >
    >>Hi Robert,
    >>
    >>here is a link to the BrowseFolder Dialog written by Terry
    >>Kreft
    >>
    >>http://www.mvps.org/access/api/api0002.htm
    >>
    >>If the folder that is being chosen will have a file in it, I
    >>like to use the OpenFile dialog and instruct them to pick a
    >>file in the folder that they want since the function to
    >>choose a folder always starts you at the root of the drive.
    >> Then I parse the filename out of what is returned and just
    >>store the path
    >>
    >>In the code to open a file, you can specify a start directory
    >>
    >>Call the standard Windows File Open/Save dialog box by
    >>Ken Getz
    >>
    >>http://www.mvps.org/access/api/api0001.htm
    >>
    >>
    >>
    >>Warm Regards,
    >>Crystal
    >>Microsoft Access MVP 2006
    >>
    >> *
    >> Have an awesome day ;)
    >>
    >> remote programming and training
    >> strive4peace2006 at yahoo.com
    >>
    >> *
    >>
    >>Robert Fonda wrote:
    >>
    >>>I would like to call the standard windows Folder Selection dialog box. The
    >>>open/save dialog box doesn't seem to offer me this option. Any ideas? I just
    >>>want the user to be able to browse folders, then select one, and return the
    >>>folder name and path to my code.
    >>>
    >>>Thoughts/suggestions/insults?

    >>
     

Share This Page