Solved

Outlook 2007 : how to choose Sent directory *each time* I send a directory?

Posted on 2009-05-14
18
275 Views
Last Modified: 2016-08-29
Hi there,

I read this http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_22918966.html
But I don't think it's exactly what I'm looking for.

=> I'm looking for something to make me choose where to store an e-mail right after it's been sent. something like a popup showing my exchange account's directory hierarchy.
I'm using this a lot with Thunderbird, via the a plugin called "Copy Sent to Current", to organize my e-mails, including the ones I send. https://addons.mozilla.org/en-US/thunderbird/addon/2561

Is there any plugin or macro code I could use to do this ?

(default would be to store in the usual Sent folder)

Thank you
0
Comment
Question by:mchkorg
  • 7
  • 6
  • 3
18 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24386925
Hello mchkorg,

I was able to get this working in Outlook 2003.  It will prompt you what folder to save outgoing mail messages
in, including an option not to save at all.  It will include the following:

do not save
Sent Items


To implement:

1) Download zip file from here...

View all files for Question ID: 24408054
https://filedb.experts-exchange.com/incoming/ee-stuff/7638-SaveToFolder.ziphttps://filedb.experts-exchange.com/incoming/ee-stuff/7640-SaveToFolder.zip
 

Direct link to your file
https://filedb.experts-exchange.com/incoming/ee-stuff/7638-SaveToFolder.zip

2) Extract files to desktop

3) Go to VB Editor and import class module ThisOutlookSession.cls

4) Import userform frmSaveToFolder.frm

5) Make sure macro security is not set to High

Now, when you send a MailItem, you should get prompted about where to save the item.

Regards,

Patrick
0
 
LVL 7

Author Comment

by:mchkorg
ID: 24412947
I'll try to test this tomorrow (I'm running out of time right now)
Can you make it choose a directory "outside" Sent items ?
I've got a whole directory structure outside Sent items, of course, and this is where I'd like to store my sent e-mails

In my projects sub-dirs, let say

Regards
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24415802
mchkorg,

I updated the objects.  View all files for Question ID: 24408054
https://filedb.experts-exchange.com/incoming/ee-stuff/7638-SaveToFolder.ziphttps://filedb.experts-exchange.com/incoming/ee-stuff/7640-SaveToFolder.zip
 

Direct link to your file
https://filedb.experts-exchange.com/incoming/ee-stuff/7640-SaveToFolder.zip

It now will show a list of all folders/subfolders in Sent Items and Inbox, and will drill down to all descendants.

Regards,

Patrick
0
 
LVL 7

Author Comment

by:mchkorg
ID: 24420162
Sorry I might be stupid with outlook macros :)

I imported both elements (I can see them on the left part of the VB editor)
I quit outlook, it asked me to save ThisOutlookSession, which I did, then restarted it
I still can send e-mails, but nothing happens :)
I tried to set the macro security to the lowest level (no security control), nothing changes

Or it's all about OL 2007 VS 2003?

Any idea?

Thank you
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24421397
mchkorg,

You should definitely only have one copy of each, so try removing all of the items related to this and reimporting
the updated objects.

I do not have OL2007 on my machine to test with.  The code should be compatible, but it is possible that there
is still some security setting that must be updated.  If there is no reply from other Experts within the next few
hours, I suggest you click the 'request attention' link and ask the Mods to try and draw in some additional
Experts.

Regards,

Patrick
0
 
LVL 7

Author Comment

by:mchkorg
ID: 24421782
One copy of each... what?
I imported only your 2nd code version, once.
About security stuff, I can't say. Except the basic setting allowing or not none/signed/all macros

0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24493030
WhackAMod (and other Experts/Mods who may see this),

The objects provided in comment 24415802 are working perfectly in my own installation of Outlook 2003.
IMHO, this question is answered.

Cheers,

Patrick
0
 
LVL 7

Author Comment

by:mchkorg
ID: 24493344
I'm sure it's working in OL2003.
Problem is I'm using OL 2007, it's written in the title
There must be some difference somewhere, I can't figure out which ones.

IMHO, the question's not answered
And if it's just a problem of macro security (I already check), that kind of stuff, if someone finds the solution, I will of course give points to everyone involved, especially for the one who wrote that big macro, you.

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 76

Expert Comment

by:David Lee
ID: 24506638
Hi, guys.

I just used Outlook 2007 to test the code matthewspatrick posted.  It worked perfectly.  Let's try a slightly different approach to setting this up in Outlook.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If there is more than one module called ThisOutlookSession, then stop and let me know
5.  If there is only one ThisOutlookSession module, then double-click on it
6.  If the code mattewspartrick provided is the only code in the module, then delete it all.  If you have any other code in the module, then delete the Application_ItemSend subroutine
7.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
8.  Click File > Import File
9.  Navigate to the file system folder where you saved the files you unzipped from the ZIP file you downloaded from eeStuff
10.  Select the file frmSaveToFolder.frm and click Open.  DO NOT import the file named ThisOutlookSession.cls
11.  Click the diskette icon on the toolbar to save the changes
12.  Close the VB Editor
13.  Click Tools > Trust Center
14.  Click Macro Security
15. Set Macro Security to "Warnings for all macros"
16. Click OK
17. Close Outlook
18. Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

Test the code and let us know what happens.

Option Explicit

Option Compare Text
 

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

    

    Dim mf As MAPIFolder

    

    If Item.Class = olMail Then

        With frmSaveToFolder

            .Show

            Select Case .cbFolders.Value

                Case "<do not save>"

                    Item.DeleteAfterSubmit = True

                Case "Sent Items"

                    Item.DeleteAfterSubmit = False

                    Set Item.SaveSentMessageFolder = _

                        Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail)

                Case Else

                    Item.DeleteAfterSubmit = False

                    Set Item.SaveSentMessageFolder = _

                        Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Folders(.cbFolders.Value)

            End Select

        End With

        Unload frmSaveToFolder

    End If

    

End Sub

Open in new window

0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24517235
BlueDevilFan said:
>>I just used Outlook 2007 to test the code matthewspatrick posted.  It worked perfectly.

Thanks for checking this, BDF!  I thought it would work, but I could not test it fully.  (No one cares that I
have Excel 2007 and the other Office 2007 components installed, bu the company standard is still
Outlook 2003 and the help desk will just laugh at me if I ever run into an issue.)

Cheers,

Patrick
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24522359
You're welcome, Patrick.  Maybe you could talk the IT folks into letting you run a virtual machine solution so you have both versions of Outlook.
0
 
LVL 7

Author Comment

by:mchkorg
ID: 24524730
Hi,

Thank you for this-by-step procedure.
It's almost working now - I tried Patrick's code and yours, here is what I get:
- when I send with a copy to Sent Items => OK
- when I send with no copy => OK
- when I choose a directory, I have an error

If using Patrick's code, the debugger points me to:
- Set mf = mf.Folders(arr(Counter))

If using yours, it points to:
- Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Folders(.cbFolders.Value)

I'm using a french Outlook, I'd bet there's something with the default inbox french name : Boîte de Réception - because of î & é
My subdirectoris in "Boîte de Réception" may have accents or not. I tried both.
I also tried to use a subdir created in the mailbox (not inbox), I can't see it.

Any idea to debug this ?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24524858
"Thank you for this-by-step procedure."
You're welcome.

"I tried Patrick's code and yours"
The code is all Patrick's.  I copied and pasted a portion of the code to avoid importing it.  
What are the errors you get?  I assume that the code doesn't appear twice, right?  Also, are you selecting a folder or typing in the name of a folder that doesn't appear in the list?  If the latter, then that is what's causing the errors.

"I also tried to use a subdir created in the mailbox (not inbox), I can't see it."
The solution only lists files that occur under Sent Items.  It does not list folders from elsewhere in the mailbox.
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 24532713
mchkorg,

OK, the info that you are using the French version may have been the breakthrough we needed.  I went back
to the Application_ItemSend sub in the ThisOutlookSession module, and changed this line:

                If arr(0) = "Inbox" Then

to:

                If arr(0) = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Name Then

That makes the code language independent, which it wasn't before.  The new code seems to work for me;
I'm crossing my fingers for you :)

Regards,

Patrick
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24532717
mchkorg,

BTW, I did also test using accented characters, creating a subfolder under my Inbox named "Acçénted".
It did not seem to mind the special characters one bit :)

Regards,

Patrick
0
 
LVL 7

Author Comment

by:mchkorg
ID: 24533638
Ok, the code modification did the trick.
Every situation is working now (sent item / do not save / somewhere else)

> "The solution only lists files that occur under Sent Items.  It does not list folders from elsewhere in the mailbox."
The subdirs are not under "Sent Items", see attached image. But they're listed and usable. Maybe I don't understand what you mean with "under Sent items"

Anyway, many thanks

20090603-080544.png
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Outlook Free & Paid Tools
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now