Results 1 to 10 of 10

Buttons to prompt for directroy. Paste directory location in corresponding cell.

Threaded View

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Buttons to prompt for directroy. Paste directory location in corresponding cell.

    I have a worksheet where I need a series of 10 buttons the user can click and specify a folder location for each. The location then needs to be pasted in the corresponding cell to the right of the button.

    - - A - B
    1 - "Button" - File location 1 returned from button A1
    2 - "Button" - File location 2 returned from button A2
    3 - "Button" - File location 3 returned from button A3
    4 - "Button" - File location 4 returned from button A4
    5 - "Button" - File location 5 returned from button A5
    6 - "Button" - File location 6 returned from button A6
    7 - "Button" - File location 7 returned from button A7
    8 - "Button" - File location 8 returned from button A8
    9 - "Button" - File location 9 returned from button A9
    10 - "Button" - File location 10 returned from button A10


    I found the below code which brings up the folder dialog box. I can't figure out how to paste the folder location in to the corresponding cell. Thanks for the help!

    Sub Folder_Location()
     
      Dim Action As Variant
      Dim FolderName As String
    
        With Application.FileDialog(msoFileDialogFolderPicker)
          .InitialFileName = "C:\Program Files\"
          .Title = "Browse Folders"
          Action = .Show
          If Action = -1 Then
             FolderName = .SelectedItems(1)
          Else
             FolderName = ""
          End If
        End With
        
    End Sub
    Last edited by Leith Ross; 06-27-2013 at 07:14 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1