How do create a macro to forward email to a specific address?


G

Guest

I use OfficeXP Outlook for email. I want to be able to use a macro or
shortcut to
select a message header, then enter a 2-3 key shortcut to forward the
message to
a specific address as an attachment and then delete the original message.
Tools => Macros just brings up the VB editor. I don't know how to use it,
or how
to begin interfacing with Outlook. Is there an easier way, such as a
keystroke
recorder?
 
Ad

Advertisements

J

John Blessing

ArloSmurf said:
I use OfficeXP Outlook for email. I want to be able to use a macro or
shortcut to
select a message header, then enter a 2-3 key shortcut to forward the
message to
a specific address as an attachment and then delete the original message.
Tools => Macros just brings up the VB editor. I don't know how to use
it,
or how
to begin interfacing with Outlook. Is there an easier way, such as a
keystroke
recorder?


No keystroke recorder in OL, so you would have to learn vbscript. But you
can get external windows programs that will do this (google for macro or
keystroke recorder). Unless you can achieve what you need using a rule in OL
--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters
 
S

Sue Mosher [MVP-Outlook]

For VBA basics, see http://www.outlookcode.com/d/vbabasics.htm Once you have your macro security set and can get a Hello World message working, you can try putting this code in a new code module:

Sub ForwardA()
Dim objMail As Outlook.MailItem
Set objItem = GetCurrentItem()
Set objMail = objItem.Forward
objMail.To = "(e-mail address removed)"
objMail.Display
Set objItem = Nothing
Set objMail = Nothing
End Sub

Sub ForwardB()
Dim objMail As Outlook.MailItem
Set objItem = GetCurrentItem()
Set objMail = objItem.Forward
objMail.To = "(e-mail address removed)"
objMail.Display
Set objItem = Nothing
Set objMail = Nothing
End Sub

Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = _
objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = _
objApp.ActiveInspector.CurrentItem
Case Else
End Select
End Function

ForwardA and ForwardB are macros that each forward the current item to a different person.

For shortcuts, you'll need to add them to your toolbar (View | TOolbars | Customize); see http://www.slipstick.com/outlook/toolbar.htm#macro

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Thank you Sue,

I entered this into a new VB code module and saved it, then set it up on my
toolbar
as SPAM -- saves me a few steps each time I use it to report spam to comcast
and the
national spam center.

Sub SPAM()
Dim objMail As Outlook.MailItem
Set objItem = GetCurrentItem()
Set objMail = objItem.Forward
objMail.To = "(e-mail address removed); (e-mail address removed)"
objMail.Display
Set objItem = Nothing
Set objMail = Nothing
End Sub

Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = _
objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = _
objApp.ActiveInspector.CurrentItem
Case Else
End Select
End Function


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

End Sub
 
Ad

Advertisements

G

Guest

Thanks for thehelp John,

I want to use this to report spam -- since the "senders" change
addresses each week, a rule only works for a short time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top