K
Kelly
Hi group, I am using office Exchange 2000
The following is some code I managed to find and
manipulate so that a specific file could be stripped form
an incoming email and placed in a specific folder.
I would like to add three things to this code.
Any suggestions would be greatly appreciated.
1. I would like to fire this macro AFTER the rule I set up
delivers a new message to the "expense claims" folder.
2. I would like suggestions on an error handler. (As there
should never be multiple attachments that situation
probably won't be an issue but there is always a chance
the code will error and I would like to be prepared)
3. The way the code is now if someone emails in an
attachment with the same name as a previous one it just
gets saved over the old one with no message asking " are
you sure you want to save over the old one?" so this would
be a nice feature but I am not sure of the code needed.
Here is what I have so far, thanks for any input!
Sub Remove_Expense_Claims()
Set MAPI = Outlook.GetNamespace("MAPI")
Set TopFolder = MAPI.Folders.Item("Mailbox - My Name")
Set ClaimsFolder = TopFolder.Folders.Item("expense claims")
intCount = ClaimsFolder.Items.Count
For i = intCount To 1 Step -1
Set myItem = ClaimsFolder.Items(i)
For Each Att In myItem.Attachments
Att.SaveAsFile "C:\Documents and Settings\krk\My
Documents\Employee Expense Claims\" & Att.FileName
myItem.Delete
Next
Next
End Sub
The following is some code I managed to find and
manipulate so that a specific file could be stripped form
an incoming email and placed in a specific folder.
I would like to add three things to this code.
Any suggestions would be greatly appreciated.
1. I would like to fire this macro AFTER the rule I set up
delivers a new message to the "expense claims" folder.
2. I would like suggestions on an error handler. (As there
should never be multiple attachments that situation
probably won't be an issue but there is always a chance
the code will error and I would like to be prepared)
3. The way the code is now if someone emails in an
attachment with the same name as a previous one it just
gets saved over the old one with no message asking " are
you sure you want to save over the old one?" so this would
be a nice feature but I am not sure of the code needed.
Here is what I have so far, thanks for any input!
Sub Remove_Expense_Claims()
Set MAPI = Outlook.GetNamespace("MAPI")
Set TopFolder = MAPI.Folders.Item("Mailbox - My Name")
Set ClaimsFolder = TopFolder.Folders.Item("expense claims")
intCount = ClaimsFolder.Items.Count
For i = intCount To 1 Step -1
Set myItem = ClaimsFolder.Items(i)
For Each Att In myItem.Attachments
Att.SaveAsFile "C:\Documents and Settings\krk\My
Documents\Employee Expense Claims\" & Att.FileName
myItem.Delete
Next
Next
End Sub