Results 1 to 8 of 8

Thread: FileDialog (XP)

  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FileDialog (XP)

    Hello everybody!

    In a vba-project, I am using the Application.FileDialog(msoFileDialogFolderPicker)-object to pick a folder. It works perfectly well except one thing. When I use the constant msoFileDialogFolderPickup, I cannot see the folders contents, only subfolders. For me, it would be a very useful information to have the content visible as well. Is there any option to realise this? I tried to use the .Filters.Add-method, but this does not work for this dialog with this constant.
    Any help will be apreciated!

    Many greetings, Porley

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: FileDialog (XP)

    I'm sorry, but the file dialog doesn't work that way. You can either see files and folders and select files (not folders), or you can only see and select folders (not files).

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: FileDialog (XP)

    I'm not sure why you are using Application.FileDialog(msoFileDialogFolderPicker)?
    But if you are wanting to automate opening folders and files then it would be better to use:
    myFile = Application.GetOpenFilename("All Files, *.*", , "Select a file")
    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Regards,
    Rudi

  4. #4
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileDialog (XP)

    Hello Hans!

    Thanks for the information. It is not what I hoped to hear, but at least the search is over...

    Best regards, Porley

  5. #5
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileDialog (XP)

    Hello Rudi!

    Thanks for your help. I have tried out your suggestion, but I found out, that you can only select files with this dialog. Picking folders is not supported (and I need a folder, not a file).

    Best regards, Porley

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: FileDialog (XP)

    You can pick a file in the folder of interest and extract the folder name from it:

    <pre> Dim strPath As String
    strPath = Application.GetOpenFilename _
    (Title:="Choose a file in the folder to start")
    If strPath = "False" Then Exit Sub

    Do Until Right(strPath, 1) = ""
    strPath = Mid(strPath, 1, Len(strPath) - 1)
    Loop</pre>


    Steve

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileDialog (XP)

    As long as the folder contains at least one file. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    Legare Coleman

  8. #8
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileDialog (XP)

    That is a good idea! I have tried, and it works perfectly.

    Thank you very much for this hint!!

Posting Permissions

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