This partial code downloads email attachements and saves using:
att.SaveAsFile "C:\Folder1\" & att.FileName
If there were more than one identical file names like:
I want it to save like
Question: How can I find whether a file exist or not bfore saving it in the directory. If it exists, endings like _1, _2, ect. has to be added to them.
For Each att In mailitem.Attachments
att.SaveAsFile fnFolderFileName("C:\Folder1\", att.FileName)
Function fnFolderFileName(strFolder as string, strFile as string)As String
Dim strTemp as string
If <wo to discover to see if file strFile exists in strFolder> = true Then
strTemp ="how to add _1, _2, etc. to the end of existing strFile s?"
strTemp = strFolder & "\" & strFile
fnFolderFileName = strTemp