Alhakeem1977
Registered User.
- Local time
- Today, 05:25
- Joined
- Jun 24, 2017
- Messages
- 308
Hi,
The code below is working perfectly to upload pdf files to a predefined folder in our local network.
1. How can I get the user confirmation to overwrite the existing file with the same name in the uploading process?
2. How can I auto rename the uploaded file to the field [RefID] automatically?
3. How can I show "Open" key word inserted of the file path? i.e. to replace the file path with another word.
The code below is working perfectly to upload pdf files to a predefined folder in our local network.
1. How can I get the user confirmation to overwrite the existing file with the same name in the uploading process?
2. How can I auto rename the uploaded file to the field [RefID] automatically?
3. How can I show "Open" key word inserted of the file path? i.e. to replace the file path with another word.
Code:
Private Sub Command201_Click()
On Error GoTo err
Dim i As Integer
Dim sPath As String
Dim sFile As String
Dim Fol As Object, DoneFiles As String
DoneFiles = "Files Uploaded are: "
Set Fol = Application.FileDialog(3)
Fol.AllowMultiSelect = False
If Fol.Show Then
For i = 1 To Fol.SelectedItems.Count
sFile = Filename(Fol.SelectedItems(i), sPath)
If Dir("D:\AttachmentsCustService\" & sFile) & "" = "" Then 'Insure if the file exist
FileCopy sPath & sFile, "D:\AttachmentsCustService\" & sFile
DoneFiles = DoneFiles & vbCrLf & i & " - " & sFile
Att = "D:\AttachmentsCustService\" & sFile
Else
MsgBox "This file already exist: " & vbCrLf & sFile & ""
If i > 1 Then MsgBox DoneFiles ' ' Mesgbox of the files uploaded
Exit Sub
End If
Next
End If
Exit Sub
err:
MsgBox "An error Occoured while uploading"
End Sub
Last edited: