can msoFileDialogFolderPicker display file names in the folder

  • Thread starter Thread starter Paul C
  • Start date Start date
P

Paul C

I am using the following section of code to have a user select a location to
save a newly created file (the name is already determined - newname)

With Application.FileDialog(msoFileDialogFolderPicker)
.Show
newloc = .SelectedItems(1)
End With

ActiveWorkbook.SaveAs Filename:=CStr(newloc) & "\" & newname

Everything works fine, but the FolderPicker only displays folders and no
contents.

While this is not critical, I would like the user to see the folder contents
for reference and it is just bugging me that I can't do this.

I know that changing to FilePicker will do this, but then the user is
picking a name and not using the predetermined newname (which I would
prefer).

Is there a way to have the FolderPicker display the folder content?
or
If using FilePicker how can you force the predetermined name to be used?
 
Try the below..Doesnt that odd that the user will have to type or select a
file to get the FilePicker OK button enabled...

Dim strFolder As String
With Application.FileDialog(msoFileDialogFilePicker)
.Show
newloc = .SelectedItems(1)
End With
strFolder = Left(newloc, InStrRev(newloc, "\"))
ActiveWorkbook.SaveAs Filename:=strFolder & newname

If this post helps click Yes
 
Set the initial file name to the new name and then Open the dialog

Dim strFolder As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = newname
.Show
newloc = .SelectedItems(1)
End With
strFolder = Left(newloc, InStrRev(newloc, "\"))
ActiveWorkbook.SaveAs Filename:=strFolder & newname

If this post helps click Yes
 
Thanks,

Both ideas look a little better than the blank FolderPicker method, that
just gives me an odd feeling that I was was doing something, but not quite
sure exactly what.

I like the one with the InitialFileName set even though it then does not
show the files within the folder.
 
Back
Top