Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Can I use a macro within Outlook ? (http://www.outlookbanter.com/outlook-vba/97664-can-i-use-macro-within.html)

Roger December 4th 09 08:53 AM

Can I use a macro within Outlook ?
 
I am using Outlook 2003. I have written vba for macros in other office apps
but not Outlook. We get a lot of emails with sales details. Many are
forwarded to another email address outside the company once they have been
checked. Because they have to be checked and decision made re forwarding or
not, I cannot use the autoforward as part of a rule.

I want a simple macro to forward a message I highlight in the inbox to a
nominated email address, using the message's subject line as the subject
line in the forwarding email (ie using the default subject). Is this
possible from within Outlook ?

thanks

Roger



Sue Mosher [MVP][_4_] December 4th 09 01:31 PM

Can I use a macro within Outlook ?
 
Yes, Outlook has a VBA environment, accessed just like that in other
applications with Alt+F11 or Tools | Macros | VBA. These pages can help you
get started:

http://www.outlookcode.com/article.aspx?id=49
http://www.outlookcode.com/article.aspx?ID=40

The item selected in the current window is returned by
Application.ActiveExplorer.Selection(1), so your macro would be something
like this:

Sub MyMacro()
Dim msg As Outlook.MailItem
Set itm = Application.ActiveExplorer.Selection(1)
Set msg = itm.Forward
msg.To = "
msg.Send
Set msg = Nothing
Set itm = Nothing
End Sub
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Roger" wrote in message
...
I am using Outlook 2003. I have written vba for macros in other office apps
but not Outlook. We get a lot of emails with sales details. Many are
forwarded to another email address outside the company once they have been
checked. Because they have to be checked and decision made re forwarding
or
not, I cannot use the autoforward as part of a rule.

I want a simple macro to forward a message I highlight in the inbox to a
nominated email address, using the message's subject line as the subject
line in the forwarding email (ie using the default subject). Is this
possible from within Outlook ?

thanks

Roger





Roger December 4th 09 02:29 PM

Can I use a macro within Outlook ?
 
Great, thanks

Roger

"Sue Mosher [MVP]" wrote in message
...
Yes, Outlook has a VBA environment, accessed just like that in other
applications with Alt+F11 or Tools | Macros | VBA. These pages can help
you get started:

http://www.outlookcode.com/article.aspx?id=49
http://www.outlookcode.com/article.aspx?ID=40

The item selected in the current window is returned by
Application.ActiveExplorer.Selection(1), so your macro would be something
like this:

Sub MyMacro()
Dim msg As Outlook.MailItem
Set itm = Application.ActiveExplorer.Selection(1)
Set msg = itm.Forward
msg.To = "
msg.Send
Set msg = Nothing
Set itm = Nothing
End Sub
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Roger" wrote in message
...
I am using Outlook 2003. I have written vba for macros in other office
apps
but not Outlook. We get a lot of emails with sales details. Many are
forwarded to another email address outside the company once they have
been
checked. Because they have to be checked and decision made re forwarding
or
not, I cannot use the autoforward as part of a rule.

I want a simple macro to forward a message I highlight in the inbox to a
nominated email address, using the message's subject line as the subject
line in the forwarding email (ie using the default subject). Is this
possible from within Outlook ?

thanks

Roger








All times are GMT +1. The time now is 04:56 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com