Consulting

Results 1 to 2 of 2

Thread: How to save attachments and move email using Rules

  1. #1
    VBAX Regular
    Joined
    Oct 2007
    Posts
    6
    Location

    How to save attachments and move email using Rules

    Hi,

    I've tried creating a rule that runs a script every time an email is sent to a email distribution.

    For some reason, the rule does not save the attachments. Can someone please help?!

    Sub attachmentrule(item As Outlook.MailItem)
    Dim atmt As Attachment
    Dim i As Integer

    If item.Attachments.Count > 0 Then
    For i = 1 To item.Attachments.Count
    If Right(atmt.FileName, 3) = "xls" Then
    FileName = "T:\Operations\Excel Attachments\" & Format(item.ReceivedTime, "yyyymmdd_hhnnss_") & atmt.FileName
    atmt.SaveAsFile FileName
    End If
    Next
    End If
    Set atmt = Nothing

    End Sub

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location

    Hi djchou,
    Welcome to the board

    We already have a thread ongoing on this:

    http://www.vbaexpress.com/forum/showthread.php?t=15438
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •