Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to open a folder on a drive, then let user select the file? Word 2002

    It's easy to record a macro that opens a folder on a drive, then open a specific Word doc. What I'm having problems with is writing a macro to open the folder, exit the sub, then let the user select the file from the open folder.

    I end up with code like ChangeFileOpenDirectory "X:\Forms" but the directory never displays. What simple code is needed to just open the folder from Word 2002 and exit the sub so that the user selects the appropriate file?

    Thanks!
    Charlie
    Charlie6067

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Charlie,

    This should do the trick.
    Code:
    Sub MyOpenFile()
    
    ChangeFileOpenDirectory "G:\BEKDocs\Word\Letters\"
    Dialogs(wdDialogFileOpen).Show
    
    End Sub
    Note: you must end the path with a backslash { \ } for the ChangeFileOpenDirectory to work.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, thank you RG! People at my work think I'm a VBA wizard but I couldn't do half of the work without great help from people like you in this forum.

    Charlie
    charlie6067

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •