none
Outlook 2010 Macro: every outgoing e-mail choose a folder to save copy. RRS feed

  • Question

  • Hello,

    I want to be asked in which Folder I want to save a copy of outgoing e-mail.

    I found this code on http://www.vboffice.net/sample.html?mnu=2&pub=6&lang=en&smp=54&cmd=showitem

    ' Variante #2
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
      If TypeOf Item Is Outlook.MailItem Then
        Cancel = Not SaveSentMail(Item)
      End If
    End Sub
    
    Private Function SaveSentMail(Item As Outlook.MailItem) As Boolean
      Dim F As Outlook.MAPIFolder
    
      If Item.DeleteAfterSubmit = False Then
        Set F = Application.Session.PickFolder
        If Not F Is Nothing Then
          Set Item.SaveSentMessageFolder = F
          SaveSentMail = True
        End If
      End If
    End Function
    

    ' --------------------------------------------

    But it doesn't seem to work.

    I made changes to the securitysettings. But how do I get it to work everytime I send an email.

    Thanx.

    Thursday, June 26, 2014 8:10 AM

Answers

  • Hi h.nekkers,

    The code works fine for me with Win7 X64/Outlook 2010. I think you must go in the wrong way. Please follow these steps to use the code:

    1. Open Developer ribbon, click Visual Basic. If you can't see the Developer ribbon, click File>Options>Customize Ribbon>Check the Developer option on the right.

    2. In the VBA editor

    3. Save the vba code, create a subfolder named "test" under the Inbox. Send a test email. then you'll find the email is copied in the test folder.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, June 27, 2014 2:32 AM
    Moderator

All replies

  • Did you try to debug the code? Is your code called by Outlook at all?

    Did you have a chance to check out the Trust Center settings in Outlook? It looks like macros are disabled in Outlook. Is this the case?

    Thursday, June 26, 2014 9:30 AM
  • Hi h.nekkers,

    The code works fine for me with Win7 X64/Outlook 2010. I think you must go in the wrong way. Please follow these steps to use the code:

    1. Open Developer ribbon, click Visual Basic. If you can't see the Developer ribbon, click File>Options>Customize Ribbon>Check the Developer option on the right.

    2. In the VBA editor

    3. Save the vba code, create a subfolder named "test" under the Inbox. Send a test email. then you'll find the email is copied in the test folder.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, June 27, 2014 2:32 AM
    Moderator