FileDialog Object

J

JFK

I use the fileDialog(msoFileDialogOpen) object to select files for a VBA
application. When I allow multiplefiles, and if the files are selected
nonsequentially using the CTRL key, it often happens that copies of the
selected files are made within the open folder inadvertently. Is there any
way to turn of file copying while using this object?
 
N

NickHK

AFAIK, as this dialog behaves the same a Windows (and I would guess is
generated by Windows, not Excel), that behaviour is by design.
The easiest alternative (apart from you users NOT doing it) is to design an
"old" style userform with a drive list box, folder list and file list.
Otherwise a more modern Explorer style interface would be better.
The API route provides for the implementation of a call back from the
dialog. Don't know if that would be useful for this though.

NickHK
 
J

JFK

Thanks Nick.

This problem is practically unavoidable in my case because I want the user
to be able to select perhaps 10 or 20 nonsequential files from a folder.
With the CTRL key depressed, if the user's cursor falls between two files in
the list while they are making their next selection, all currently selected
files are copied to the folder.

I wonder if the xlDialogOpen ojbect might solve this problem, or if I can
temporarily designate the folder as read-only.
 
N

NickHK

The xlDialogOpen has these arguments:
'1 - 8
'file_text, update_links, read_only, format, prot_pwd, write_res_pwd,
ignore_rorec, file_origin,
'9 - 14
'custom_delimit , add_logical, editable, file_access, notify_logical,
converter

None is obviously involved in changing the behaviour, but with no
documentation on what they mean (e.g. ignore_rorec ??), some quick testing
with True/false values produced nothing useful.
None in the flags for GetOpenFilename API suggest this can be overridden
(except maybe with a callback).

There are various replacement controls that you can control their behaviour,
but then you users will have to install them.
As this is part of Windows drag/drop behaviour, it would be easier if you
can create your own userform with a combobox for drives, a list box for
folders and a list box for files. Update the folders list when drive changes
and update files list when the folder changes. That way the interface does
not support drag/drop.

NickHK
 

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