Expand|Select|Wrap|Line Numbers
- Private Sub cmdbtnupload_Click()
- Dim fDialog As Office.FileDialog
- Set fd = Application.FileDialog(msoFileDialogFilePicker)
- Dim varFile As Variant
- ' Set up the File Dialog. '
- Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
- 'fd.InitialFileName = Application.CurrentProject.Path
- fd.InitialFileName = "c:\"
- With fDialog
- ' Allow user to make multiple selections in dialog box '
- .AllowMultiSelect = False
- ' Set the title of the dialog box. '
- .Title = "Please select a File to Attache"
- ' Clear out the current filters, and add our own.'
- .Filters.Clear
- .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
- ' This section takes the selected image and copy's it to the generated path'
- ' the string takes the file location, navigates to the image folder, uses the combo box selection to decide the file category, then uses the name from the filedialog to finish the path'
- FileCopy .SelectedItems(1), Application.CurrentProject.Path & "\Files\" & Combo153 & "\" & Dir(Trim(.SelectedItems.Item(1)))
- Me.attachmentpath.SetFocus
- RunCommand acCmdInsertHyperlink
- Else
- End If
- End With
- End Sub