PDA

View Full Version : Solved: Outlook 2003 (quick steps?)



TrippyTom
11-09-2010, 04:48 PM
Hi gang,

I know quick steps wasn't introduced until Outlook 2010, but I want to simulate that feature in Outlook 2003. I don't know anything when it comes to writing code for Outlook.

I would like to, on selected email, click the macro button to:
1) FORWARD it TO:, CC: (specific email addresses)
2) APPEND "[TEXT HERE]" before the actual subject of the email
3) ADD text to the body of the forwarded message "[this is the added text]"

* I don't want it to actually send. I want the macro to stop right before that (so I can make changes to the message if necessary)

Is something like this possible? I realize there is no macro recorder in Outlook 2003 so I'm resorting to asking here. Thanks. :)

p.s. - I am not a student and this is not homework. :)

JP2112
11-16-2010, 12:17 PM
Try this:

Sub Do_Something()
Dim msg As Outlook.MailItem
Dim msgFwd As Outlook.MailItem
Dim toRecip As Outlook.Recipient
Dim ccRecip As Outlook.Recipient

' grab currently selected item ...
Set msg = ActiveExplorer.Selection.Item(1)

' forward it ...
Set msgFwd = msg.Forward

' create TO and CC fields ...
With msgFwd
Set toRecip = .Recipients.Add "To"
toRecip.Type = olTo

Set ccRecip = .Recipients.Add "CC"
ccRecip.Type = olCC

' edit subject ...
.Subject = "[TEXT HERE]" & " " & .Subject

' and body ...
.Body = "[this is the added text]" & vbCrLf & .Body

' finally, display it on screen.
.Display
End With

End Sub

To assign this macro to a toolbar button, see http://www.codeforexcelandoutlook.com/blog/2009/11/create-outlook-toolbar-buttons-using-vba/.

TrippyTom
02-17-2011, 03:58 PM
Thanks JP!

I had to tweak the TO and CC lines:
Set toRecip = .Recipients.Add("To")
Set ccRecip = .Recipients.Add("CC")


But it works great!