+ Reply to Thread
Results 1 to 7 of 7

Using GetOpenFilename

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-11-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    108

    Question Using GetOpenFilename

    Hi. I am having trouble specifying the folder I want when using GetOpenFilename. It takes me to the folder I want but there are no excel files in there.

    Application.GetOpenFilename("Folder Path, Excel Files (*.xls)")


    Any pointers?

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Using GetOpenFilename

    You are using Excel 2010 so try changing the file extension to Application.GetOpenFilename("Folder Path, Excel Files (*.xlsx)")
    Elegant Simplicity............. Not Always

  3. #3
    Forum Contributor
    Join Date
    04-11-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Using GetOpenFilename

    In fact it doesn't even take me to the folder I want. Nevertheless I changed it to xlsx and there were no excel files in a folder that I know has excel files.

    Could it be it is not locating the Folder because the path is not in my documents but on another drive on my server?

  4. #4
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Using GetOpenFilename

    Best way to get the full file path is to navigate to it with explorer then copy the name from the filepath display at the top..

    In my experience you have to be a bit careful with shared drives across networks because I.T. move files to another server occasionally as part of maintenance....

    You could aslo just use asterixes in the file type just to verify you are looking into the right folder.

  5. #5
    Forum Contributor
    Join Date
    04-11-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Using GetOpenFilename

    What if it is a 97-2003 excel file?

  6. #6
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Using GetOpenFilename

    Then it should be an .xls extension...... but looking more closely ..

    Try this

    Dim f As Variant
    f = Application.GetOpenFilename("All Files (*.*),*.*")
        If f <> False Then
            Workbooks.Open Filename:=f
        End If
    or even

     Application.GetOpenFilename ("All Files (*.*),*.*")
    That's in it's simplest form which will open the current folder

    I think the Folder Path you specify in your code is a string variable and should not be enclosed in quotes.
    Last edited by AndyLitch; 04-24-2013 at 07:10 AM.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Using GetOpenFilename

    GetOpenFilename does not provide the ability to select a folder. you could use chdrive and chdir to change the current path before showing the dialog
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ 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