Hello guys,
I would like to modify this function so that the InitialFileName will change according to the user selected path except for the penultimate portion of the path.
For example, within a loop, if the first time the selected path is:
"U:\Mypath\MySubFolder\ABC\CDE\Filex.pdf"
I would like the function to "memorize"
.InitialFileName as "U:\Mypath\MySubFolder\ABC\"
until the end of the loop.
No luck so far..
Many thanks in advance for any suggestions!
I would like to modify this function so that the InitialFileName will change according to the user selected path except for the penultimate portion of the path.
For example, within a loop, if the first time the selected path is:
"U:\Mypath\MySubFolder\ABC\CDE\Filex.pdf"
I would like the function to "memorize"
.InitialFileName as "U:\Mypath\MySubFolder\ABC\"
until the end of the loop.
No luck so far..
VBA Code:
Function GetFolderName(Optional OpenAt As String) As String
Dim wbFullName As Variant
With Excel.Application.FileDialog(msoFileDialogFolderPicker)
wbFullName = Excel.Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "U:\Mypath\MySubFolder\"
.Show
GetFolderName = .SelectedItems(1)
End With
End Function
Many thanks in advance for any suggestions!