get file name root folder

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
569
Office Version
  1. 365
Platform
  1. Windows
I have the get folder location function listed below. I would like the dialogue box that opens to start into a specific root directory. This will allow the user to start at this location which they select the final destination from the list of folders within the root directory. How to I modify the following code so that the dialogue box opens to my desired directory? Is that even possible?

Desired Directory for the dialogue box to start from: T:\Work Files\Active Accounts\


Code:
Function GetFolder_Save_Here () As String


Application.DisplayAlerts = False


Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
    .Title = "Select a Folder"
    .AllowMultiSelect = False
    If .Show <> -1 Then GoTo NextCode
    sItem = .SelectedItems(1)
End With
NextCode:
GetFolder = sItem
Set fldr = Nothing
Sheets("Intro Page").Range("AA3").Value = sItem & "\"
Sheets("Intro Page").Range("AA5").Value = sItem


If sItem = "" Then
    Exit Function
End If


Application.DisplayAlerts = True


End Function

Thanks for the help.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Add this line as shown
Code:
      .AllowMultiSelect = False
     [COLOR=#ff0000] .InitialFileName = "T:\Work Files\Active Accounts"
[/COLOR]
 
Upvote 0
Beautiful!! Thanks. I figured it would be something fairly simple.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,797
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top