difficult to read your code without formatting and code tags so I'll just post what I use and I think you'll be able to see where it goes.
Code:
Function fBrowse(PickType As MsoFileDialogType, Optional StartFolder As String = "", Optional strTitle As String = "") As String
On Error GoTo fBrowse_Error
Dim mso As Object
Dim varFile As Variant
If Nz(strTitle, "") = "" Then
Select Case PickType
Case 3
strTitle = "Select a File"
Case 4
strTitle = "Select a Folder"
Case Else
strTitle = ""
End Select
Else
strTitle = strTitle
End If
Set mso = Application.FileDialog(PickType)
With mso
.Title = strTitle
.AllowMultiSelect = False
.InitialFileName = StartFolder
.Filters.Clear
If PickType = msoFileDialogFilePicker Then
.Filters.Add "All Files", "*.*"
.Filters.Add "PDF file", "*.pdf"
.Filters.Add "Image Files", "*.jpg,*.jpeg,*.BMP,*.Png,*.TIFF,"
.Filters.Add "Audio Files", "*.Wav,*.mp4"
End If
If .Show = True Then
If .SelectedItems.Count = 0 Then
fBrowse = ""
End If
For Each varFile In .SelectedItems
fBrowse = varFile
Next
Else
fBrowse = ""
End If
End With
On Error GoTo 0
Exit Function
fBrowse_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure fBrowse, line " & Erl & "."
End Function
Btw, suggest you write a public function to handle this kind of procedure, or use mine or any other you can find.
Then in the button click on your form you only need
Code:
Me.Location = fBrowse(msoFileDialogFilePicker, "C:\Windows\DocumentStorage")