Hello,
This is my first day in the forum so I want to say Hello to everybody ,
I m new in VBA so please support me if I made any mistakes
If possible, I m asking help regarding the issue bellow,
I found a small code to copy/past attached files from received emails to a specific file,
The problem is some attached files have a space " " in the end of their names so I want to copy/past them & Correct the name by removing the space,
Now after excexuting my code, the file are attached normally but once a file with " " is detected, no more file are attached,
Unfortunately I can't attache any file as the code is in outlook
Here after my code :
Thank you for your support
This is my first day in the forum so I want to say Hello to everybody ,
I m new in VBA so please support me if I made any mistakes
If possible, I m asking help regarding the issue bellow,
I found a small code to copy/past attached files from received emails to a specific file,
The problem is some attached files have a space " " in the end of their names so I want to copy/past them & Correct the name by removing the space,
Now after excexuting my code, the file are attached normally but once a file with " " is detected, no more file are attached,
Unfortunately I can't attache any file as the code is in outlook
Here after my code :
Code:
Public Sub s2aveAttachtoRapportDetailléParEquipeFile(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Users\LZYRFY\Desktop\Nouveau dossier (2)"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
FileName = CreateObject("Scripting.FileSystemObject").GetBaseName(objAtt)
File1 = "C:\Users\LZYRFY\Desktop\Nouveau dossier (2)\" & FileName
MsgBox (File1)
If Right(FileName, 1) = " " Then
FileName = Left(FileName, Len(FileName) - 1)
File2 = "C:\Users\LZYRFY\Desktop\Nouveau dossier (2)\" & FileName
MsgBox (File2)
Name File1 As File2
End If
Set objAtt = Nothing
Next
End Sub
Thank you for your support