I have the following code which allows user to select file. That portion works; but I would like the initial location of the folder that the user will be browsing to to be hard coded.
Private Sub InputFile_Click()
Dim fDialog As Office.FileDialog
Dim filename As Variant
Dim varFile As Variant
Dim oApp As Object
Set oApp = CreateObject("Excel.Application")
' Clear listbox contents. '
Me.TextBoxName = ""
' Set up the File Dialog. '
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
' Set the title of the dialog box. '
.Title = "Please choose File"
' Clear out the current filters, and add our own.'
.Filters.Clear
.Filters.Parent = "R:\Location of where file typically resides\"
.Filters.Add "Excel csv", "*.csv"
.Filters.Add "Flat File txt", "*.txt"
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the '
' user picked at least one file. If the .Show method returns '
' False, the user clicked Cancel. '
If .Show = True Then
'Loop through each file selected and add it to our list box. '
For Each varFile In .SelectedItems
filename = Right(varFile, 51)
FileCopy varFile, "\\network\location\" & filename
Me.TextBoxName = filename
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub