Function dialogFolderBrowse() As String
'##### This function gives the user the facility to browse for a file or folder and to be able to use the path
'##### as a destination.
'##### You must include the Microsoft Office Object Library, go to Tools/References
'##### Returns the selected folder address
'##### written by ??
Dim fp As FileDialog
Dim vrtSelectedItem As Variant
Dim varX As String
'this next line is an optional warning to the user so they know what is about to happen
MsgBox "You will now be asked to browse to the required folder location", vbOKOnly
'Create a FileDialog object as a Folder Picker dialog box.
Set fp = Application.FileDialog(msoFileDialogFolderPicker) ' can use msoFileDialogFilePicker for filenames
fp.AllowMultiSelect = True
If fp.Show = -1 Then
'this is the only way I've been able to assign the selected path as a value to string variable
For Each vrtSelectedItem In fp.SelectedItems
varX = vrtSelectedItem
'vrtSelectedItem is a String that contains the path of each selected item.
Next vrtSelectedItem
End If
dialogFolderBrowse = varX
End Function