I've added a button on my form. The idea is the user will click the button and a file dialog box will open. The user will select a file (PDF) and I would like to take the file and save it to a different network location with a different name.
I don't think I'm using the File Dialog application correctly. Any suggestions?
Private Sub Upload1stTraining_Click()
Dim fd As FileDialog
Dim objfl As Variant
Dim strDestFile As String
Dim strUploadFile As String
Dim strTrainingName As String
strTrainingName = Me.ID & " - " & Me.Line & " 1st.pdf"
strDestFile = "S:\QUALITY\QUALITY ALERTS\Training Records\" & strTrainingName
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.ButtonName = "Select"
.AllowMultiSelect = False
.Filters.Add "PDF", "*.pdf"
.Title = "Choose Transactions file to import"
.InitialView = msoFileDialogViewDetails
.Show
For Each objfl In .SelectedItems
strUploadFile = objfl
Next objfl
On Error GoTo 0
End With
Set fd = Nothing
' Enter code to save the strUploadFile to the strDestFile
Me.Ctl1st_Shift_Training = True
End Sub