macro to forward

D

Dan

Does anyone know how I can add a subject to this macro?


Sub ForwardMe()
On Error Resume Next
Set thisItem = Application.ActiveInspector.CurrentItem
Set fwdItem = thisItem.Forward
fwdItem.To = "(e-mail address removed)"
fwdItem.Send
End Sub

In other words how can I write the macro to include a message like
(Forwarded from DC) on the subject line?

Thannks
 
S

Sue Mosher [MVP-Outlook]

fwdItem.Subject = "Forwarded from DC"

When in doubt, check the object browser: Press ALt+F11 to open the VBA environment in Outlook, then press F2. Switch from <All Libraries> to Outlook to browse all Outlook objects and their properties, methods, and events. Select any object or member, then press F1 to see its Help topic.

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

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

Dan

Sue:

This is very helpful. Thank you.

I have one additional issue. When I try to set up a second macro to forward
to an additional person, it screws up my original macro. I really the
solution may be very simple. Unfortunately, I have not been able to set up a
second macro to send to a different person. Any help would be GREATLY
appreciated.
 
S

Sue Mosher [MVP-Outlook]

Screws it up how? Did you remember to give the second macro a different name?

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

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

Dan

Maybe I am exposing my ignorance but I simply repeat the process (with a
different email address) right below (there is a line for a break) the first
macro. This is where the curnsor takes me after I type in a new macro name.
Am I doing something wrong to create a new macro?
 
D

Dan

Should I be doing something other than
typing

Tools/Macros/Create/Enter New Macros Name/Copy Instructions from prior
macros with new email address for the forward/save/return to outlook
 
S

Sue Mosher [MVP-Outlook]

Sub tells VBA that it's a subroutine, not a Function. The name is the second "word" in the procedure. Each procedure in a module needs a unique name, so if you want to name it Mo, it would be:

Sub Mo()

The parentheses at the end can be empty or can hold the names of parameters -- data that your procedure will use in its code.

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

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

Sue Mosher [MVP-Outlook]

That sounds like Word, not Outlook. Outlook doesn't have a Create command in the Macros dialog.

The easiest way to create a macro is simply to open the Outlook VBA environment with Alt+F11 and start typing in the built-in ThisOutlookSession module.

If you're new to Outlook VBA macros, these web pages should help you get started:

http://www.winnetmag.com/Articles/Index.cfm?ArticleID=21522&pg=1
http://www.outlookcode.com/d/vb.htm

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

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

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