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

Create a macro in Outlook to run a rule



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 11th 10, 08:47 PM posted to microsoft.public.outlook.program_vba
DLGolfs
external usenet poster
 
Posts: 25
Default Create a macro in Outlook to run a rule

I am sorry, I did not mean that you should debug it; I just don't know what I
am doing. I went to 'help" and found out what the 'locals window" is. b/c I
did not kow what it was.
I thought that I could copy /paste the result in this e-mail but I do not
see an avenue to do that.

So, I ran it w/o breaks and it just shows this but, this is probably not
helpful:

ONs nothing Name space
Ostore nothing store
colrules nothing rules
orule nothing rule

then when I put a breakpoint at the end of the set colrules o store linee,
it gives me a ton of lines, what should I look for? Most have "+" signs and
I able to expand it

At least I understand now what you want me to do.

"Ken Slovak - [MVP - Outlook]" wrote:

Open the Locals window, that will show all variables in scope and their
values. I mentioned that earlier in the thread.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DLGolfs" wrote in message
...
What are values of the vairables? Is there a way to see that?

All I know is if I run it and/or brekapoint it , then it either does
nothing, that is litterally nothing happens OR it opens VB and shows me
the
first line in yellow


.

  #2  
Old March 12th 10, 02:33 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a macro in Outlook to run a rule

If you looked at locals when the code had finished they would all be Nothing
(null). What you want to do is to put the breakpoint on the line after
colRules is set.

You should then see valid objects for NameSpace, Store and Rules objects.
For example instead of Nothing you'd be able to expand the value and see
settings such as Name.

That tells you the base objects you need are all set. Then using F8 to step
the code one executable line at a time you can execute that line of code and
see what other variables are doing. Does the rule you want get found and
instantiated as oRule, etc.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DLGolfs" wrote in message
...
I am sorry, I did not mean that you should debug it; I just don't know what
I
am doing. I went to 'help" and found out what the 'locals window" is. b/c
I
did not kow what it was.
I thought that I could copy /paste the result in this e-mail but I do not
see an avenue to do that.

So, I ran it w/o breaks and it just shows this but, this is probably not
helpful:

ONs nothing Name space
Ostore nothing store
colrules nothing rules
orule nothing rule

then when I put a breakpoint at the end of the set colrules o store linee,
it gives me a ton of lines, what should I look for? Most have "+" signs
and
I able to expand it

At least I understand now what you want me to do.


  #3  
Old March 12th 10, 03:59 PM posted to microsoft.public.outlook.program_vba
DLGolfs
external usenet poster
 
Posts: 25
Default Create a macro in Outlook to run a rule

OK, I put my cursor at the end of the line
Set colRules = oStore.GetRules()
right click, toggle , breakpoint, it turns brown,
click run and it shows

+module4 module4/module4
no variables
+ : oNS : : NameSpace/NameSpace
+ : oStore : : Store/Store
: colRules : Nothing : Rules
: oRule : Nothing : Rule

So I don't see Namespace, store and rules, I see what is above.

Now what? I cannot expand colRules or oRule there is no + sign

orules nothing

"Ken Slovak - [MVP - Outlook]" wrote:

If you looked at locals when the code had finished they would all be Nothing
(null). What you want to do is to put the breakpoint on the line after
colRules is set.

You should then see valid objects for NameSpace, Store and Rules objects.
For example instead of Nothing you'd be able to expand the value and see
settings such as Name.

That tells you the base objects you need are all set. Then using F8 to step
the code one executable line at a time you can execute that line of code and
see what other variables are doing. Does the rule you want get found and
instantiated as oRule, etc.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DLGolfs" wrote in message
...
I am sorry, I did not mean that you should debug it; I just don't know what
I
am doing. I went to 'help" and found out what the 'locals window" is. b/c
I
did not kow what it was.
I thought that I could copy /paste the result in this e-mail but I do not
see an avenue to do that.

So, I ran it w/o breaks and it just shows this but, this is probably not
helpful:

ONs nothing Name space
Ostore nothing store
colrules nothing rules
orule nothing rule

then when I put a breakpoint at the end of the set colrules o store linee,
it gives me a ton of lines, what should I look for? Most have "+" signs
and
I able to expand it

At least I understand now what you want me to do.


.

  #4  
Old March 12th 10, 04:18 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a macro in Outlook to run a rule

So what happens if you press F8 after you hit the breakpoint? You should be
in the line after setting colRules and colRules should not be Nothing and
should now have a + that you can expand to see properties such as Count,
which should have a number. Another F8 should instantiate your oRule object
and that then should not be Nothing and should be expandable to show
properties such as Name.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DLGolfs" wrote in message
...
OK, I put my cursor at the end of the line
Set colRules = oStore.GetRules()
right click, toggle , breakpoint, it turns brown,
click run and it shows

+module4 module4/module4
no variables
+ : oNS : : NameSpace/NameSpace
+ : oStore : : Store/Store
: colRules : Nothing : Rules
: oRule : Nothing : Rule

So I don't see Namespace, store and rules, I see what is above.

Now what? I cannot expand colRules or oRule there is no + sign

orules nothing


  #5  
Old March 12th 10, 06:11 PM posted to microsoft.public.outlook.program_vba
DLGolfs
external usenet poster
 
Posts: 25
Default Create a macro in Outlook to run a rule



"Ken Slovak - [MVP - Outlook]" wrote:

So what happens if you press F8 after you hit the breakpoint? You should be
in the line after setting colRules and colRules should not be Nothing and
should now have a + that you can expand to see properties such as Count, THERE IS NO "PROPERTIES" AND NO "COUNT"


I GET THE FOLLOWING AND WHEN i EXPAND THE ONS THERE IS NO 'COUNT" JUST
ACCOUNTS, ADDRESS LISTS, APPLICATIONS, CATERGORIES, CURRENT USER, DEFAULT
STORE, FOLDERS MAPIOBJECT, PARENT SESSION, STORES, AND SYNCOBJECTS ...DO YOU
MEAN ACCOUNT OR COUNT? THIS IS WHAT I SEE EVERYTIME, :
- : Module4 : : Module4/Module4
: oStore : Nothing : Store
: oNS : Nothing : NameSpace
: colRules : Nothing : Rules
: oRule : Nothing : Rule
OK, THEN F8 AND IT HIGHLIGHTS THE FIRST LINE AND NOTHING CHANGES AS YOU SEE
ABOVE
THEN ANOTHER F8 AND IT HIGHLIGHTS THE SET ONS LINE AND NOTHING CHANGES AS
YOU SEE ABOVE
THEN ANOTHER F8 AND IT HIGHLIGHTS THE SET OSTORE LINE AND AGAIN NOTHING
CHANGES AS YOU SEE ABOVE AND SO ON
IF SOMETHING IS CHANGING IN THE EXPANSION, IT WOULD IMPOSSIBLE FOR ME TO
TELL UNLESS YOU DIRECT ME TO A CERTAIN PLACE


which should have a number WHERE?

.. Another F8 should instantiate your oRule object
and that then should not be Nothing and should be expandable to show
properties such as Name.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DLGolfs" wrote in message
...
OK, I put my cursor at the end of the line
Set colRules = oStore.GetRules()
right click, toggle , breakpoint, it turns brown,
click run and it shows

+module4 module4/module4
no variables
+ : oNS : : NameSpace/NameSpace
+ : oStore : : Store/Store
: colRules : Nothing : Rules
: oRule : Nothing : Rule

So I don't see Namespace, store and rules, I see what is above.

Now what? I cannot expand colRules or oRule there is no + sign

orules nothing


.

  #6  
Old March 15th 10, 12:52 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a macro in Outlook to run a rule

In case you didn't know it all caps is hard to read and is considered as
shouting.

I have no idea what's going on. If you never get valid NameSpace, Store or
Rules collection objects obviously the code will never fire the rule. But
the code to get those objects should just work.

You are running this in Outlook 2007, with nothing in the code other than
what's been shown, and no errors are fired?

Select Tools, Trust Center and select the Macro Security tab. What is the
setting there? What about on the Programmatic Access tab?

Something is drastically wrong with your setup or there's something going on
that we're not being told about. Otherwise at minimum the line setting
NameSpace would work.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"DLGolfs" wrote in message
...


"Ken Slovak - [MVP - Outlook]" wrote:

So what happens if you press F8 after you hit the breakpoint? You should
be
in the line after setting colRules and colRules should not be Nothing and
should now have a + that you can expand to see properties such as Count,
THERE IS NO "PROPERTIES" AND NO "COUNT"


I GET THE FOLLOWING AND WHEN i EXPAND THE ONS THERE IS NO 'COUNT" JUST
ACCOUNTS, ADDRESS LISTS, APPLICATIONS, CATERGORIES, CURRENT USER, DEFAULT
STORE, FOLDERS MAPIOBJECT, PARENT SESSION, STORES, AND SYNCOBJECTS ...DO
YOU
MEAN ACCOUNT OR COUNT? THIS IS WHAT I SEE EVERYTIME, :
- : Module4 : : Module4/Module4
: oStore : Nothing : Store
: oNS : Nothing : NameSpace
: colRules : Nothing : Rules
: oRule : Nothing : Rule
OK, THEN F8 AND IT HIGHLIGHTS THE FIRST LINE AND NOTHING CHANGES AS YOU
SEE
ABOVE
THEN ANOTHER F8 AND IT HIGHLIGHTS THE SET ONS LINE AND NOTHING CHANGES AS
YOU SEE ABOVE
THEN ANOTHER F8 AND IT HIGHLIGHTS THE SET OSTORE LINE AND AGAIN NOTHING
CHANGES AS YOU SEE ABOVE AND SO ON
IF SOMETHING IS CHANGING IN THE EXPANSION, IT WOULD IMPOSSIBLE FOR ME TO
TELL UNLESS YOU DIRECT ME TO A CERTAIN PLACE


 




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
Outlook 2007 rule won't start a macro Dmitry Sotnikov Outlook and VBA 1 August 1st 08 04:57 PM
Create a Macro in Outlook Bert Outlook and VBA 10 July 2nd 08 08:32 PM
Run macro through rule Flash08 Outlook - General Queries 2 December 20th 07 04:16 PM
create Macro, Outlook 2007 - create is grayed out Dave Horne[_2_] Outlook - General Queries 2 November 4th 07 09:45 AM
Create a macro that runs from a Rule CF_business_analyst Outlook and VBA 8 January 13th 06 05:12 PM


All times are GMT +1. The time now is 06:11 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-2025 Outlook Banter.
The comments are property of their posters.