+ Reply to Thread
Results 1 to 4 of 4

GetOpenFileName

  1. #1
    Registered User
    Join Date
    08-31-2005
    Posts
    48

    GetOpenFileName

    Hi,

    Is there a way to select the folder path as opposed to the file path using this method.

    directory = Application.GetOpenFilename("Excel Files (*.xls), *.xls")

    I want to use the save as window, similar to selecting the file path with the above line. Things is I want the folder/directory path.

    Any ideas would be greatly appreciated.

    Cheers,

    Tom

  2. #2
    Ron de Bruin
    Guest

    Re: GetOpenFileName

    Hi

    See the second example on this page
    http://www.rondebruin.nl/windowsxpzip.htm

    You can use the code from that macro


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Tomski" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi,
    >
    > Is there a way to select the folder path as opposed to the file path
    > using this method.
    >
    > directory = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
    >
    > I want to use the save as window, similar to selecting the file path
    > with the above line. Things is I want the folder/directory path.
    >
    > Any ideas would be greatly appreciated.
    >
    > Cheers,
    >
    > Tom
    >
    >
    > --
    > Tomski
    > ------------------------------------------------------------------------
    > Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
    > View this thread: http://www.excelforum.com/showthread...hreadid=472937
    >




  3. #3
    Jim Cone
    Guest

    Re: GetOpenFileName

    Tom,
    This gives you the folder for the file selected in GetOpenFileName...
    '-------------------------------
    Sub FolderFromFilePath()
    Dim strLocation As Variant
    Dim N As Long

    strLocation = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
    If strLocation = False Then Exit Sub
    For N = Len(strLocation) To 1 Step -1
    If Mid$(strLocation, N, 1) = "\" Then Exit For
    Next

    strLocation = Left$(strLocation, N - 1)
    MsgBox strLocation
    End Sub
    '-------------------------
    Jim Cone
    San Francisco, USA

    "Tomski"
    <[email protected]>
    wrote in message
    news:[email protected]...

    Hi,
    Is there a way to select the folder path as opposed to the file path
    using this method.
    directory = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
    I want to use the save as window, similar to selecting the file path
    with the above line. Things is I want the folder/directory path.
    Any ideas would be greatly appreciated.
    Cheers,
    Tom


  4. #4
    Registered User
    Join Date
    08-31-2005
    Posts
    48
    Nice one guys, thanks for that.

    T

+ 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