Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save attachments from Outlook 1

Status
Not open for further replies.

air1access

Technical User
Jan 27, 2008
123
US
I am working with some code that saves the attachments on selected emails...

It saves out the first attachment, and then the next attachment has the file name + a formatted date trailing on the name...
It does this because the attachments are all named the same thing.

I don't want it to name the files like that - I want it to save the first attachment, and for the rest, add 1 to the file name..
So -
savedattachment.csv
savedattachment_1.csv
savedattachment_2.csv
savedattachment_3.csv
And so on...

Below is what I am working on:

Do While objFSO.FileExists(strAtmtPath)
strAtmtNameTemp = strAtmtName(0) & _
Format(Now, "_mmddhhmmss") & _
Format(Timer * 1000 Mod 1000, "000") + 1
[/b]

'CMS Daily New Seminar Reports_0223130204477

strAtmtPath = strFolderPath & strAtmtNameTemp & "." & strAtmtName(1)

' /* If the length of the saving path is over 260 characters.*/
If Len(strAtmtPath) > MAX_PATH Then
lCountEachItem = lCountEachItem - 1
' False: This attachment cannot be saved.
blnIsSave = False
Exit Do
End If
Loop
 
Hi,

Code:
'
   Dim i as Integer
'...
   i = 0
   Do While objFSO.FileExists(strAtmtPath)
      If i = 0 then
         strAtmtNameTemp = strAtmtName(0)
      Else
         strAtmtNameTemp = strAtmtName(0) & "_" & i
      End if
'....
      i = i + 1
   Loop


Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top