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

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
LVL 7
mchkorgAsked:
Who is Participating?
 
Patrick MatthewsConnect With a Mentor Commented:
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
 
Patrick MatthewsCommented:
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
 
mchkorgAuthor Commented:
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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
Patrick MatthewsCommented:
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
 
mchkorgAuthor Commented:
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
 
Patrick MatthewsCommented:
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
 
mchkorgAuthor Commented:
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
 
Patrick MatthewsCommented:
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
 
mchkorgAuthor Commented:
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
 
David LeeCommented:
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
 
Patrick MatthewsCommented:
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
 
David LeeCommented:
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
 
mchkorgAuthor Commented:
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
 
David LeeCommented:
"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
 
Patrick MatthewsCommented:
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
 
mchkorgAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.