Your code has a major redundancy: The item that triggered the rule is the objMailItem object passed as an argument. Yet you are instantiating an Outlook.Application object (totally unnecessary) and a Selection object. Instead, your code needs to act on the item that fired the rule.

Signature
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> Hi,
>
[quoted text clipped - 43 lines]
> For Each objMsg In objSelection
> ' This code only strips attachments from mail items.
Andrew - 11 Nov 2006 02:25 GMT
Thanks Sue ... apprecite you time.
Better pull your book off the shelf again :-)
Andrew
> Your code has a major redundancy: The item that triggered the rule is the objMailItem object passed as an argument. Yet you are instantiating an Outlook.Application object (totally unnecessary) and a Selection object. Instead, your code needs to act on the item that fired the rule.
>
[quoted text clipped - 45 lines]
> > For Each objMsg In objSelection
> > ' This code only strips attachments from mail items.
computerwhiz4@gmail.com - 28 Nov 2006 18:37 GMT
It was really impossible to find something like this... after searching
for over an hour , I muddled through and modified the "select and save
macro from somewhere" to do what I wanted.
It will automatically save any attachments on incoming new emails to
C:\Attachments
It probably has some flaws that could be fixed or w/e, but it does what
I want.
Sub SaveAttachments(Item As Outlook.MailItem)
Dim i As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolderpath As String
strFolderpath = "C:\Attachments\"
On Error Resume Next
Set objAttachments = Item.Attachments
lngCount = objAttachments.Count
If lngCount > 0 Then
For i = lngCount To 1 Step -1
strFile = objAttachments.Item(i).FileName
strFile = strFolderpath & strFile
objAttachments.Item(i).SaveAsFile strFile
Next i
End If
ExitSub:
Set objAttachments = Nothing
End Sub
> Thanks Sue ... apprecite you time.
>
[quoted text clipped - 59 lines]
> > > For Each objMsg In objSelection
> > > ' This code only strips attachments from mail items.