Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 22 of 22

Thread: Solved: Problems with automatic save attachment

  1. #21
    VBAX Newbie
    Joined
    Apr 2010
    Posts
    2
    Location
    Hello, How can I have this work eventhough the session is not up?

  2. #22
    Quote Originally Posted by Killian
    The fact that this code works fine for me but not for you (we're both on OL2003) makes me think there's something else going on here but while I was struggling to work out what that is, I found a much better way of doing the whole thing...

    In the rules wizard, as well as moving your mail item, you can then choose to run a script. What I didn't realise, was that if you include a mailitem object as an argument to that routine, it will indeed refer to the mailitem the rule is applied to! Perfect!

    So, set the rule for incoming mail to move the mail and run a script.
    This is the script to run:[vba]Public Sub RuleScriptSaveAtt(Item As MailItem)

    Dim olAtt As Attachment
    Dim i As Integer

    If Item.Attachments.Count > 0 Then
    For i = 1 To Item.Attachments.Count
    Set olAtt = Item.Attachments(i)
    olAtt.SaveAsFile FILE_PATH & olAtt.FileName
    Next
    End If
    Set olAtt = Nothing

    End Sub[/vba]
    Hello

    Would the above script have to be run in conjunction with the original script? If not and it can be used on its own to save attachments, as part of a Rule, wouldn't that mean an Outlook client does not need to be running? If so, where would the local C: drive be? On the Exchange server the mailbox resides? Or could attachments be saved to a UNC path?

    Thanks in advance.

Posting Permissions

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