PDA

View Full Version : Preventing File Open Dialog selecting more than 1 item



DanielHowden
07-26-2011, 03:04 AM
This code will show me the File Open dialog but it will allow me to select more than 1 file. Is there a switch where I can limit the selection to just 1 file?

Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogOpen)

fd.Show


Cheers Daniel.

Frosty
07-26-2011, 09:43 AM
fd.AllowMultiSelect = False

Other arguments which you might find useful:

.ButtonName = "Something Else"
.Title = "A Title goes here"
.InitialFileName = "C:\" 'put a path here

In another thread, I saw you indicated you know how to use watches.

Watch your filedialog object, and you'll see a number of useful items-- you can check the count of the .SelectedItems to determine if anything was selected, etc.

Hope this helps.

DanielHowden
07-27-2011, 12:10 AM
Thanks Frosty, that was exactly what I was looking for.

Cheers Daniel.