here is the solution
Private Sub BrowseToDir() 'Declare variables Dim strOriginalPath As String Dim x As Variant Dim strSelectedPath As String 'Remember oroginal path strOriginalPath = CurDir 'Show dialog and let user browse to a directory x = Application.GetSaveAsFilename(InitialFileName:="_", Title:="Browse to desired directory and click Save") 'Get current directory, and show it strSelectedPath = CurDir MsgBox strSelectedPath 'Change back to original drive and path On Error Resume Next ChDrive strOriginalPath ChDir strOriginalPath MsgBox strOriginalPath On Error GoTo 0 End Sub On Fri, Feb 20, 2009 at 12:00 AM, Tony <tony.kild...@seattle.gov> wrote: > > Hi all, > > I want to allow the user of my macro to see and navigate through the > directory structure and to select a target directory that the macro > can. I was hoping there was something "like" GetOpenFileName that > would return the directory string. I'm sure it's possible to code > such a function from scratch, but I'm not sure I'm up to that. Was > never slick at this and now I'm rusty on top of that. Looking for the > easy way out. > > In Excel 2002 under XP. > > Thanks, Tony. > > > > -- Thanks & Regards, Harmeet Singh --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---