Link to home
Start Free TrialLog in
Avatar of sarahjackel
sarahjackel

asked on

Common Dialog filter for only folders

Hello,
I am using the common dialog to allow the user to navigate to the folder where their data is stored.  I only want to allow them to see and select folders.  How do I write this in the filter command due to folders not having an extension?
 ex. commonDialog.Filter = "*.exe|*.exe"

thanks in advance!
Sarah
Avatar of gbzhhu
gbzhhu
Flag of United Kingdom of Great Britain and Northern Ireland image

You will have to use browseforfolder code following
Use the Browse for Folders API:

Implementing the Browse For Folders Dialog
http://vbnet.mvps.org/code/browse/browsefolders.htm
Avatar of sarahjackel
sarahjackel

ASKER

sorry...I forgot to add that I am writing this in VBA.  I tried the code in the links, but I get an eror on the line:
.hWndOwner = Me.hWnd

any other suggestions?

sarah
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Tomlinson
You can just put 0 (zero) in for owner:

    .hOwner = 0
Erick beat me to it!!
Terrific!  Thank you all for your very fast answers!
By the way sarahjackel,

I don't want any points for this question as it has been more than adequately answered by Erick37 and gbzhhu.

I just happened to see your comment and answered at the same time as Erick37.

=)