A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can I use a macro within Outlook ?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 4th 09, 08:53 AM posted to microsoft.public.outlook.program_vba
Roger
external usenet poster
 
Posts: 5
Default 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


Ads
  #2  
Old December 4th 09, 01:31 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default 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




  #3  
Old December 4th 09, 02:29 PM posted to microsoft.public.outlook.program_vba
Roger
external usenet poster
 
Posts: 5
Default 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






 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set off VBA macro on email receipt then that macro accesses the emailcontent [email protected] Outlook and VBA 3 February 5th 09 12:14 AM
OL 2003 crashes on macro (Alt-F8) or macro editor (Alt-F11) mikewillnot Outlook - General Queries 0 May 5th 08 03:42 PM
Outlook macro abends but Word macro runs successfully Jreue Outlook and VBA 0 December 13th 06 11:55 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Outlook and VBA 5 October 4th 06 06:26 AM


All times are GMT +1. The time now is 08:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.