[RESOLVED] [Office 2003] FileDialog Sorting
I am using the code modified from the below to let the user select a file to process.
However in some of these places they need to see the FileDiaglow sorted by Date/Time,
whilst in others they need to see it sorted by Name.
Is there any way to do this in VBA?
Code:
Dim fd As FileDialog
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Use a With...End With block to reference the FileDialog object.
With fd
.AllowMultiSelect = False
.Title = "Select File for Processing"
.InitialFileName = ThisWorkbook.Path & "\*.xls"
.InitialView = msoFileDialogViewDetails
'Use the Show method to display the File Picker dialog box and return
' the user's action.
If .Show = -1 Then 'The user pressed the action button.
debug.print .SelectedItems(1)
Else ' The user pressed Cancel.
MsgBox "Loading of File aborted"
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
Re: [Office 2003] FileDialog Sorting
i have seen /had code to do this for a common dialog, but not sure if it would work with an excel filedialog
http://www.codeguru.com/forum/showthread.php?t=404040
but, having looked at it again, i am not sure that this will work in vba owing to lack of hwnd
Re: [Office 2003] FileDialog Sorting
Thanks westconn.
Looks like it cannot be done, except with a custom built dialog.