FileDialog grey's out the View box

B

Budget Programmer

Hello,
I want to select one particular folder, but I need the view box to appear so
that I can sort the folders by modified date, name, etc. The "View" box is
greyed out.
Thanks for you help.

Private Sub GetFolderName()

Dim strSelectedFullFolder As String
Dim strSelectedFolder As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.AllowMultiSelect = False
.InitialView = msoFileDialogViewDetails
.Show
strSelectedFullFolder = .SelectedItems(1)
strSelectedFolder = Mid(strSelectedFullFolder, 68,
Len(strSelectedFullFolder))
End With

End Sub
 
R

RB Smissaert

I am not sure it can be done with FileDialog object, but if you want I can
post API code that gives you much more control and that can do it.

RBS
 
R

RB Smissaert

A simple way (not involving API) is to do:

Set fd = Application.FileDialog(msoFileDialogOpen)

and take the folder from the produced file path.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top