Solved

How do I limit navigation options with VBA filedialog

Posted on 2010-11-24
6
972 Views
Last Modified: 2012-05-10
I am trying to limit the navigation abilities of FileDialog(msoFileDialogFolderPicker).  I am setting the initialfilename to the folder I wish to start from.   I want to allow navigation to any subfolder within the initial file name, but prevent from navigating higher.   Below is a snipit of my code,  How can I restrict my navigation capabilities?  

Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.InitialFileName = "C:\WINDOWS\system32"
fd.Show
0
Comment
Question by:DavidWoods57017
6 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 334 total points
ID: 34212504
there's no built in mechanism in common dialog controls to restrict specific folder.
With the common dialog, you can browse any folder on any drive to which your login account has access and/or permissions.
what you can do is customize your own file dialog control which implements folder restrictions.



0
 

Author Comment

by:DavidWoods57017
ID: 34212918
sedqwick stated: what you can do is customize your own file dialog control which implements folder restrictions.  Can someone provide an example of customizing a a file dialog control?
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 334 total points
ID: 34212945
check this post for custom dialogs tutorial:
http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=15
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 166 total points
ID: 34214635
...Now making a custom "File Dialog" box will be even trickier...

You will somehow set a "Top" folder.

But the key lies in sedqwick's  first post:
"With the common dialog, you can browse any folder on any drive to which your login account has access and/or permissions."
So if you could restrict the users Login Access to all but your Top level folder, you may have a shot here...

What would the worse case be if a user browsed above a certain folder?

JeffCoachman
   
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34959151
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now