Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prompt to Save Sent Messages (2003/SBS2003)

    Hi guys,

    Does anyone know a way of having Outlook prompt you to save a message you are sending - currently all outgoing messages are saved to the sent items folder. I know I can change that so that they get saved to a user defined folder if you are replying from there -- but what I really want to be able to do is have a prompt come up for all outgoing messages saying "where do you want to save this message" - Lotus notes has this feature and it is one I have been waiting for in Outlook for a while.

    Please note that my requirements are different to those in post - Save copy of sent messages (2003)
    Post: 368246

  2. #2
    Lounger
    Join Date
    Jan 2001
    Location
    Slough, Berkshire, England
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    The only way I know of doing this is by writing some VB code that is associated with the SEND event. I use the following code:

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objFolder As MAPIFolder

    If TypeName(Item) <> "MailItem" Then
    Exit Sub
    End If

    Set objNS = Application.GetNamespace("MAPI")
    Set objFolder = objNS.PickFolder

    If TypeName(objFolder) <> "Nothing" Then
    Set Item.SaveSentMessageFolder = objFolder
    Else
    Set Item.SaveSentMessageFolder = objNS.Folders(olFolderDeletedItems)
    End If

    Set objFolder = Nothing
    Set objNS = Nothing

    End Sub

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    In addition to David's suggestion, I think there is an event associated with an item being added to a folder. If so, you could use code to display the Sent Items folder and pop up the Move to Folder dialog, essentially mimicking the manual process that I suspect you are using now. If there are only certain folders you would want to use, it may well be worth creating a UserForm with those listed. If the number is small enough and a pretty display is not a requirement, an InputBox will do.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    thanks for your prompt response Dave. I have never used code in outlook before - I tried just pasting your code sample into the VB editor but nothing happens. Can you step me through what I have done wrong?

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    You will need to place it in the "ThisOutlookSession" module, under "Microsoft Office Outlook Objects", not a regular VBA module.

    FWIW this simplified version will leave a copy whatever Folder you set as the default Sent Items folder, where Davids' code sends it to the Deleted Items folder

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objFolder As MAPIFolder

    If Item.Class <> olMail Then Exit Sub
    Set objFolder = Application.GetNamespace("MAPI").PickFolder
    Item.Save
    If Not objFolder Is Nothing Then Item.Move objFolder
    Set objFolder = Nothing
    End Sub
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    5 Star Lounger Ruff_Hi's Avatar
    Join Date
    Feb 2001
    Location
    New York, New York, USA
    Posts
    768
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    I had a similar issue where I wanted to save some but not all. I set the 'automatically save sent items' to checked and put this code in the send command.

    <pre>Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

    Dim lsMessage As String
    lsMessage = "Do you want to keep a copy of this email?"
    Item.DeleteAfterSubmit = Not (MsgBox(lsMessage, vbYesNo) = vbYes)

    End Sub
    </pre>



    When I hit the send button, I get prompted to save it or not. Selecting YES, saves it and selecting NO doesn't save it. Its not exactly the answer you are looking for but it could be added to the other code so that you can either 'not save', 'save to default' or 'save to another folder'.
    (Location Australia, then UK, but now USA. Heart, outlook, attitude, etc always Australian)
    Quote: "All Happiness is the release of internal pressure"

  7. #7
    Lounger
    Join Date
    Jan 2001
    Location
    Slough, Berkshire, England
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    Karen,
    Just to clarify how to get this code into place.
    Open the VB editor.
    Expand the default project.
    Expand the node that says "Microsoft Office Outlook Objects"
    Then click on "This Outlook Session"
    Paste the code into the empty screen.
    As one of the replies to my posting observed, my code will send an email to Deleted Items if you press Cancel when prompted for a location; this is to prevent me saving emails that I know I do not wish to keep. You may prefer not to have this functionality, in which case the simpler code is better.
    I hope that makes sense.

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    Thank you to all who contributed - John's macro works perfectly - will help no end in keeping me organised.

    Once again the lounge comes through

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    Hi John

    The code worked perfectly yesterday. Today however, nothing happens - message just goes into sent items -- has it got anything to do with it being in the "This Outlook Session" area?

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    Is the folder selection dialog showing up (and the folder selection being ignored)? Any error messages?
    -John ... I float in liquid gardens
    UTC -7ąDS

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    What is your Macro Security setting? It may need to be Medium for the code to run.
    -John ... I float in liquid gardens
    UTC -7ąDS

  12. #12
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    It was high - I set it to medium so I get a warning when I go into outlook. That wouldn't have been a big deal and worked fine last night. This morning I am got a message saying that the item has been deleted so cannot be moved whenever I pressed the send - the email disappears - not in drafts nor in sent items - just gone. So I had to remove the code in order to get my email to work.

    Any other suggestions?

  13. #13
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    <img src=/S/blush.gif border=0 alt=blush width=15 height=15> Karen, my face is red. I'm having the same problem now. I have tried several approaches, and there is some kind of timing problem in 2003 where sometimes it works, sometime it gives the error and works, and sometimes it doesn't work. I'm working on a kludge, but I better attend to the work they pay me for first.
    -John ... I float in liquid gardens
    UTC -7ąDS

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    Following from my earlier suggestion, here's a suggestion that works in Outlook 2002. Once the sent message is added to the Sent Items folder, Outlook displays the folder picker and, if a folder is chosen, moves the message. (Unlike my earlier suggested method, this procedure does not change the user's view, it remains wherever it was.)
    1. <LI>Open the Outlook VBE and insert a new Class Module. For purposes of this exercise, rename the module clsLounge. (If you choose another name, use that name in place of clsLounge below.)

      <LI>Paste the following code in clsLounge (if you have already used the variable name mySentItems, you can substitute something else throughout the following):
      <pre>Public WithEvents mySentItems As Outlook.Items

      Private Sub mySentItems_ItemAdd(ByVal Item As Object)
      ' This event handler is triggered every time a message is added to Sent Items
      Dim fldNew As Outlook.MAPIFolder
      Set fldNew = Outlook.Application.GetNamespace("MAPI").PickFolde r
      If Not fldNew Is Nothing Then
      Item.Move fldNew
      Set fldNew = Nothing
      End If
      End Sub</pre>

      <LI>Open a regular (not a Class) Module or insert a new regular code module (any name you like). Add a variable declaration at the top of the module outside of any Sub or Function:
      <pre>Public evtSentItems As New clsLounge</pre>

      Note: The New is important. You will get a run-time error in the InitSentItemsEvent procedure if you don't use it.

      <LI>Paste the following code in the module:
      <pre>Sub InitSentItemsEvent()
      Set evtSentItems.mySentItems = Application.GetNamespace("MAPI"). _
      GetDefaultFolder(olFolderSentMail).Items
      End Sub</pre>

      <LI>Open ThisOutlookSession (under Microsoft Outlook Objects in the project explorer pane). Look for an event handler that starts with Private Sub Application_Startup(). If you don't find one, add one either manually or using the drop down lists at the top of the code page.

      <LI>Paste the following code into the Application_Startup procedure:
      <pre>InitSentItemsEvent</pre>

      <LI>Compile the project (Debug > Compile ProjectName). If there are errors, either you or I made a mistake. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

      <LI>Save the project (File > Save VbaProject.OTM) and close the editor.

      <LI>Initialize the event handler. Alt+F8 > InitSentItemsEvent > Run
    You should be ready to test it out. Hope this helps.

  15. #15
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt to Save Sent Messages (2003/SBS2003)

    Just another very minor thing - when I copied and pasted the code from your post it all appeared in one line -- I put the line breaks in manually.

    I was able to just cut and paste John's code straight in to the VB editor.

Page 1 of 2 12 LastLast

Posting Permissions

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