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

How do I run a rule by using a toolbar icon?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 19th 10, 12:48 AM posted to microsoft.public.outlook.program_vba
DLGolfs
external usenet poster
 
Posts: 25
Default How do I run a rule by using a toolbar icon?

I have Outlook 2007 and have a rule set up to delte spam by detecting certain
words in the spam.
Here is what someone gave me but it does not work:

Sub RunRuleDeleteSpam()
Dim oNS As Outlook.NameSpace
Dim oStore As Outlook.Store
Dim colRules As Outlook.Rules
Dim oRule as Outlook.Rule

Set oNS = Application.GetNameSpace("MAPI")
Set oStore = oNS.DefaultStore
Set colRules = oStore.Rules
Set oRule = colRules.Item("Delete Spam")
oRule.Execute
End Sub
If I run it it highlights the set oRule line and stops, I guess. I know
nothing about programming, I'll admit, but am not ignorant on computer
processes. I thought if I could make a macro to run a rule then I could put
the macro in a toolbar icon and just click on it instead of having to go
through a series of clicks.
What do you think? Is the formula wrong or what?
Ads
  #2  
Old March 19th 10, 06:57 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How do I run a rule by using a toolbar icon?



What does the error message say? I guess the rule "Delete Spam" doesn't
exist.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
http://www.vboffice.net/product.html?lang=en


Am Thu, 18 Mar 2010 17:48:01 -0700 schrieb DLGolfs:

I have Outlook 2007 and have a rule set up to delte spam by detecting

certain
words in the spam.
Here is what someone gave me but it does not work:

Sub RunRuleDeleteSpam()
Dim oNS As Outlook.NameSpace
Dim oStore As Outlook.Store
Dim colRules As Outlook.Rules
Dim oRule as Outlook.Rule

Set oNS = Application.GetNameSpace("MAPI")
Set oStore = oNS.DefaultStore
Set colRules = oStore.Rules
Set oRule = colRules.Item("Delete Spam")
oRule.Execute
End Sub
If I run it it highlights the set oRule line and stops, I guess. I know
nothing about programming, I'll admit, but am not ignorant on computer
processes. I thought if I could make a macro to run a rule then I could

put
the macro in a toolbar icon and just click on it instead of having to go
through a series of clicks.
What do you think? Is the formula wrong or what?

  #3  
Old March 20th 10, 10:21 AM posted to microsoft.public.outlook.program_vba
DLGolfs
external usenet poster
 
Posts: 25
Default How do I run a rule by using a toolbar icon?

No error just highlights the the line
Yes, the rul Delete Spam does exisit, I can run it manually all the time.

I tried to export the rules and put the file here but it did not work.
I have the rule name Delete Spam

"Michael Bauer [MVP - Outlook]" wrote:



What does the error message say? I guess the rule "Delete Spam" doesn't
exist.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
http://www.vboffice.net/product.html?lang=en


Am Thu, 18 Mar 2010 17:48:01 -0700 schrieb DLGolfs:

I have Outlook 2007 and have a rule set up to delte spam by detecting

certain
words in the spam.
Here is what someone gave me but it does not work:

Sub RunRuleDeleteSpam()
Dim oNS As Outlook.NameSpace
Dim oStore As Outlook.Store
Dim colRules As Outlook.Rules
Dim oRule as Outlook.Rule

Set oNS = Application.GetNameSpace("MAPI")
Set oStore = oNS.DefaultStore
Set colRules = oStore.Rules
Set oRule = colRules.Item("Delete Spam")
oRule.Execute
End Sub
If I run it it highlights the set oRule line and stops, I guess. I know
nothing about programming, I'll admit, but am not ignorant on computer
processes. I thought if I could make a macro to run a rule then I could

put
the macro in a toolbar icon and just click on it instead of having to go
through a series of clicks.
What do you think? Is the formula wrong or what?

.

  #4  
Old March 20th 10, 10:23 AM posted to microsoft.public.outlook.program_vba
DLGolfs
external usenet poster
 
Posts: 25
Default How do I run a rule by using a toolbar icon?

No error just highlights the line as I stated below. That is it.
Yes, the rule Delete Spam does exisit, I can run it manually all the time.

I tried to export the rules and put the file here but it did not work.
I have the rule name Delete Spam

"Michael Bauer [MVP - Outlook]" wrote:



What does the error message say? I guess the rule "Delete Spam" doesn't
exist.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
http://www.vboffice.net/product.html?lang=en


Am Thu, 18 Mar 2010 17:48:01 -0700 schrieb DLGolfs:

I have Outlook 2007 and have a rule set up to delte spam by detecting

certain
words in the spam.
Here is what someone gave me but it does not work:

Sub RunRuleDeleteSpam()
Dim oNS As Outlook.NameSpace
Dim oStore As Outlook.Store
Dim colRules As Outlook.Rules
Dim oRule as Outlook.Rule

Set oNS = Application.GetNameSpace("MAPI")
Set oStore = oNS.DefaultStore
Set colRules = oStore.Rules
Set oRule = colRules.Item("Delete Spam")
oRule.Execute
End Sub
If I run it it highlights the set oRule line and stops, I guess. I know
nothing about programming, I'll admit, but am not ignorant on computer
processes. I thought if I could make a macro to run a rule then I could

put
the macro in a toolbar icon and just click on it instead of having to go
through a series of clicks.
What do you think? Is the formula wrong or what?

.

  #5  
Old March 23rd 10, 08:14 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How do I run a rule by using a toolbar icon?



if you modify the code to this:

On Error Resume Next
Set oRule = colRules.Item("Delete Spam")
MsgBox Err.Description

what does the prompt tell you?

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
http://www.vboffice.net/product.html?lang=en


Am Sat, 20 Mar 2010 03:23:01 -0700 schrieb DLGolfs:

No error just highlights the line as I stated below. That is it.
Yes, the rule Delete Spam does exisit, I can run it manually all the time.

I tried to export the rules and put the file here but it did not work.
I have the rule name Delete Spam

"Michael Bauer [MVP - Outlook]" wrote:



What does the error message say? I guess the rule "Delete Spam" doesn't
exist.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
http://www.vboffice.net/product.html?lang=en


Am Thu, 18 Mar 2010 17:48:01 -0700 schrieb DLGolfs:

I have Outlook 2007 and have a rule set up to delte spam by detecting

certain
words in the spam.
Here is what someone gave me but it does not work:

Sub RunRuleDeleteSpam()
Dim oNS As Outlook.NameSpace
Dim oStore As Outlook.Store
Dim colRules As Outlook.Rules
Dim oRule as Outlook.Rule

Set oNS = Application.GetNameSpace("MAPI")
Set oStore = oNS.DefaultStore
Set colRules = oStore.Rules
Set oRule = colRules.Item("Delete Spam")
oRule.Execute
End Sub
If I run it it highlights the set oRule line and stops, I guess. I know
nothing about programming, I'll admit, but am not ignorant on computer
processes. I thought if I could make a macro to run a rule then I could

put
the macro in a toolbar icon and just click on it instead of having to

go
through a series of clicks.
What do you think? Is the formula wrong or what?

.

 




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
Where did my Spelling (ABC) icon on the toolbar go? Basharat A. Javaid Outlook - General Queries 1 August 26th 08 01:29 PM
OL2002: Can't Remove Icon From Toolbar Daddy Outlook - General Queries 1 April 5th 08 08:15 PM
New Mail Icon on Toolbar Doen Not Appear 144memnon Outlook Express 13 November 25th 06 01:42 PM
Mail icon missing in IE toolbar anlsn Outlook Express 3 June 26th 06 10:50 AM
Toolbar icon customization problem chasse//casse.700250amp Outlook Express 4 January 19th 06 11:50 PM


All times are GMT +1. The time now is 07:33 PM.


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.