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

Rules an macro



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 11th 06, 07:19 PM posted to microsoft.public.outlook.program_vba
Gerd Neumann
external usenet poster
 
Posts: 2
Default Rules an macro

Hi,

is there any way to execute rules with a macro?

First I want to read all new mails an then klick a button to move them to
other folders by the defined rules.

G.


Ads
  #2  
Old May 11th 06, 07:31 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Rules an macro

No, you can execute VBA code with a rule, but not vice versa, at least not until Outlook 2007.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Gerd Neumann" wrote in message ...
Hi,

is there any way to execute rules with a macro?

First I want to read all new mails an then klick a button to move them to
other folders by the defined rules.

G.


  #3  
Old May 16th 06, 11:14 PM posted to microsoft.public.outlook.program_vba
Alan in NJ
external usenet poster
 
Posts: 4
Default Rules an macro

Could you please explain how to put the Macro in a rule. I have a macro
that works, but in the Rules Wizzard I can only find reference to scripts
and custom actions.
Thanks.
Alan
"Sue Mosher [MVP-Outlook]" wrote in message
...
No, you can execute VBA code with a rule, but not vice versa, at least not
until Outlook 2007.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Gerd Neumann" wrote in message
...
Hi,

is there any way to execute rules with a macro?

First I want to read all new mails an then klick a button to move them to
other folders by the defined rules.

G.




  #4  
Old May 17th 06, 04:27 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Rules an macro

A "run a script" rule action in Outlook 2002 or 2003 actually uses not an external script but a VBA procedure with a MailItem or MeetingItem as its parameter. That item is processed by the code:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Alan in NJ" wrote in message ...
Could you please explain how to put the Macro in a rule. I have a macro
that works, but in the Rules Wizzard I can only find reference to scripts
and custom actions.


  #5  
Old May 17th 06, 09:48 PM posted to microsoft.public.outlook.program_vba
Alan in NJ
external usenet poster
 
Posts: 4
Default Thanks.

Many thanks for the help. I'll give it a try.
Alan
"Sue Mosher [MVP-Outlook]" wrote in message
...
A "run a script" rule action in Outlook 2002 or 2003 actually uses not an
external script but a VBA procedure with a MailItem or MeetingItem as its
parameter. That item is processed by the code:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another
example.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Alan in NJ" wrote in message
...
Could you please explain how to put the Macro in a rule. I have a macro
that works, but in the Rules Wizzard I can only find reference to scripts
and custom actions.



 




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
Tacking Macro Bob_BLC Outlook and VBA 8 December 5th 07 06:00 AM
macro security Charlie Outlook and VBA 2 August 10th 06 12:46 AM
Error Macro? belto Outlook - General Queries 1 April 4th 06 05:23 PM
outlook macro matt Outlook and VBA 1 January 30th 06 01:30 PM
VB and outlook macro need help jbullington Outlook and VBA 1 January 10th 06 03:22 PM


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


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