Advertisement

04.29.2008 at 09:53AM PDT, ID: 23362694
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

Browse for Folder Needs to Navigate to Parent Folder

Asked by owntor in Microsoft Excel Spreadsheet Software

Tags: , ,

I came across an Excel VBA method which allows the user to browse through the folder.  However it does not provide the option to navigate up one level to the parent folder.  I am looking to add a control button to the    folder browse dialog box which would enable the user to navigate up one level.  

 Is there a control for this feature that I can include in the method?

This code is written by Ken Puls and is published at http://www.vbaexpress.com/kb/getarticle.php?kb_id=284.
I modified it slightly for my uses.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
Option Explicit
 
'Ease of Use   Easy
'Version tested with   '97, 2003
'Submitted by:  Ken Puls
'Description:   This function will allow a user to Browse for a folder (at a user defined starting point if desired.)
'It is easy to use, as the code requires no API's or special references.
 
'Discussion:    There may be times when a user needs to point a procedure to a particular folder, say to open of save a file from/to.
'This macro allows the user to browse to the folder, and returns the full file path to the folder selected, or
'FALSE if an invalid entry was chosen. Another approach to this can (by DRJ) be found at http://www.vbaexpress.com/kb/getarticle.php?kb_id=246
 
 
Function BrowseForFolder(Optional OpenAt As Variant) As Variant
'Function purpose:  To Browser for a user selected folder.
'If the "OpenAt" path is provided, open the browser at that directory
'NOTE:  If invalid, it will open at the Desktop level
 
    Dim ShellApp As Object
 
    'Create a file browser window at the default folder
    Set ShellApp = CreateObject("Shell.Application").BrowseForFolder(0, "Please choose a folder", 0, OpenAt)
 
    'Set the folder to that selected.  (On error in case cancelled)
    On Error Resume Next
    BrowseForFolder = ShellApp.self.Path
    On Error GoTo 0
 
    'Destroy the Shell Application
    Set ShellApp = Nothing
 
    'Check for invalid or non-entries and send to the Invalid error
    'handler if found
    'Valid selections can begin L: (where L is a letter) or
    '\\ (as in \\servername\sharename.  All others are invalid
    Select Case Mid(BrowseForFolder, 2, 1)
    Case Is = ":"
        If Left(BrowseForFolder, 1) = ":" Then GoTo Invalid
    Case Is = "\"
        If Not Left(BrowseForFolder, 1) = "\" Then GoTo Invalid
    Case Else
        GoTo Invalid
    End Select
 
    Sheets("control").Range("folder_name_1").Value = BrowseForFolder
 
    Exit Function
 
Invalid:
    'If it was determined that the selection was invalid, set to False
    BrowseForFolder = False
 
End Function
[+][-]04.29.2008 at 10:10AM PDT, ID: 21464137

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: Micro, VBA, Excel
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628