get file name root folder

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
503
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.
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,412
Office Version
  1. 365
Platform
  1. Windows
Add this line as shown
Code:
      .AllowMultiSelect = False
     [COLOR=#ff0000] .InitialFileName = "T:\Work Files\Active Accounts"
[/COLOR]
 

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
503
Beautiful!! Thanks. I figured it would be something fairly simple.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,412
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,127,348
Messages
5,624,145
Members
416,014
Latest member
MickP69

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
Top