Save Sent Message To....

jbeaucaire

Well-known Member
Joined
May 8, 2002
Messages
6,012
I'm using a standard little Excel macro to send an individual email to each person in a list:

Code:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With ActiveSheet
    For Each Email In .Range("T2:T70")
        With OutMail
            .To = Email
            .CC = ""
            .BCC = ""
            .Subject = .Range("A" & Email.Row) & " - Computer Updated"
            .Body = "Message text here"
            .Display   'or use .Send
            '.send
        End With
    Next Email
End With


Problem, I'd like to set the "Save Sent Message To:" option on each of these emails, too. Is there a way to do this in Excel VBA? I could just copy all these emails manually out of the SENT EMAILS folder, but if it's possible to file them using the macro, even better.
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
This was resolved in the other thread. The use of the .CreateItemFromTemplate method allows me to use a template that already has the correct Save To folder setup in the template's options, it also as the added benefit of inserting my Signature, too.

The Final code:
Code:
Option Explicit

Sub EmailUpdates()
Dim OutApp  As Object
Dim OutMail As Object
Dim Emails  As Range
Dim Email   As Range
Dim Subject As String

If MsgBox("Process the Activesheet?", vbYesNo, "Proceed?") = vbNo Then Exit Sub

With ActiveSheet
    Set Emails = .Range("T2", .Range("T" & .Rows.Count).End(xlUp)).SpecialCells(xlFormulas, 2)
    Set OutApp = CreateObject("Outlook.Application")
    
    For Each Email In Emails
        Set OutMail = OutApp.CreateItemFromTemplate("C:\Documents and Settings\Jerry\Application Data\Microsoft\Templates\Monetra Upgrade Completed - VP2.oft")
        Subject = Email.Offset(, -19) & " - Monetra Updated"
        With OutMail
            .To = Email.Text
            .Subject = Subject
            .Display
            '.Send
        End With
        Email.Offset(, -1) = "Done"
    Next Email
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top