UnsolvedCoding
Technical User
It was requested that the folder picker start at a specific location on the F drive. I am not aware of how to do this using the folder or file picker, does anyone know how?
Here's the code.
Option Explicit
Sub Get_Path()
' This get path has the user select a folder and then
' simply puts the path in cell B1. No files are shown
' in the selected folder.
' Just in case something goes wrong
On Error GoTo Error_Handler
Application.StatusBar = "Obtaining path for files"
' msoFileDialogFilePicker is the same except for the name
Dim lngCount As Long
Dim sFileName
' Open the file dialog
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = True
.Show
' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
sFileName = .SelectedItems(lngCount)
Next lngCount
End With
Range("B1").Value = sFileName
' Bye-bye
Exit Sub
Error_Handler:
'Tell the user what went wrong
Application.StatusBar = "Get_Path failed. " & Err.Description
' Set flag to indicate problem
Warning_Flag = 1
End Sub