Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2017, 11:58 PM
scar1 scar1 is offline Filing sent items in folders Windows 7 64bit Filing sent items in folders Office 2016
Novice
Filing sent items in folders
 
Join Date: Mar 2017
Posts: 4
scar1 is on a distinguished road
Default Filing sent items in folders

Hi,

Like many I prefer to keep my inbox tidy and with folders created store email threads and conversations in their associated folder. So when sending a mail I have applied a macro to show a dialogue box for me to select the folder the sent item should be moved to. What would also be great would be to include the original mail in the move that way it moves out of my inbox and gets filed in the same folder as the sent.

Any help is appreciated.
scar1

The macro code used to file the sent item is below;

Quote:
Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
On Error Resume Next
Set objNS = Application.Session
If Item.Class = olMail Then
Set objFolder = objNS.PickFolder
If Not objFolder Is Nothing And _
IsInDefaultStore(objFolder) And _
objFolder.DefaultItemType = olMailItem Then
Set Item.SaveSentMessageFolder = objFolder
Else
Set objFolder = _
objNS.GetDefaultFolder(olFolderSentMail)
Set Item.SaveSentMessageFolder = objFolder
End If
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub

Public Function IsInDefaultStore(objOL As Object) As Boolean
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace


Dim objInbox As Outlook.MAPIFolder
Dim blnBadObject As Boolean
On Error Resume Next
Set objApp = objOL.Application
If Err = 0 Then
Set objNS = objApp.Session
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Select Case objOL.Class
Case olFolder
If objOL.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
Else
IsInDefaultStore = False
End If
Case olAppointment, olContact, olDistributionList, _
olJournal, olMail, olNote, olPost, olTask
If objOL.Parent.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
Else
IsInDefaultStore = False
End If
Case Else
blnBadObject = True
End Select
Else
blnBadObject = True
End If
If blnBadObject Then
MsgBox "This function isn't designed to work " & _
"with " & TypeName(objOL) & _
" objects and will return False.", _
, "IsInDefaultStore"
IsInDefaultStore = False
End If
Set objApp = Nothing
Set objNS = Nothing
Set objInbox = Nothing
End Function
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting items in folders doesnt send them to deleted items! marshy365 Outlook 0 07-29-2016 03:19 AM
Filing sent items in folders IMAP Outlook 2007; items are not transferred to respective folders Intruder Outlook 1 05-18-2016 10:32 PM
Outlook 2010 - Delete for Items in in folders greyed out Aeolus Outlook 1 04-16-2014 10:49 AM
Outlook filing my incoming messages based on rules I apply :( dmbegg Outlook 0 09-19-2011 01:51 PM
Outlook 2007 Saved sent items list only holds the last ten items david.peake Outlook 0 06-01-2010 07:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft