Outlook 2002 Script - Rules Problem

W

Walter

My first attempt at outlook VB:

To get my feet wet I decided to use Knowledge Base
Article - 306108 code to test the scripting of rules. I
added the following sub to the "This Outlook Session"
Module.
I then set up a rule applying to all arriving messages
and clicked script and referenced the below sub.

Sub CustomMailMessageRule(Item As Outlook.MailItem)
MsgBox "Mail message arrived: " & Item.Subject & "
from: " & Item.SenderName
End Sub

I never get a message box.

I followed the following procedure from Sue Mosher's
Outlook article
http://www.win2000mag.net/Articles/Index.cfm?
ArticleID=22950

To create the rule that uses the subroutine, follow these
steps:
1. Click Tools, Rules Wizard.
2. In the first Rules Wizard dialog box, click New.
3. Select Start from a blank rule, then select Check
messages when they arrive; click Next.
4. From the What condition(s) do you want to check?
list, select the conditions you want to apply to this
rule. If you want to convert all incoming HTML messages
to plain text, click Next without setting any conditions
and answer Yes when Outlook asks whether you want the
rule to apply to every message you receive.
5. From the What do you want to do with the message?
list, select run a script.
6. In the Rule description box at the bottom of the
Rules Wizard dialog box, click the underlined words a
script.
7. In the Select Script dialog box, select
Project1.ConvertHTMLToDefault, then click OK.
8. Click Next and add any exceptions to the rule
(e.g., mailing lists that you prefer to receive in HTML
format). Click Next again.
9. Give the rule a name, then click Finish. Click OK
to close the Rules Wizard.
And I substituted Sue Mosher's reference to the
variable "objMsg As MailItem"
So this code was also tried

Sub CustomMailMessageRule(objMsg As MailItem)
MsgBox "Mail message arrived: " & objMsg.Subject & "
from: " & objMsg.SenderName
End Sub

I have Office XP Developer installed. I also run Norton
Anti-Virus.
The Office XP & Developer were clean install's on a newly
formatted HD and Windows XP (home).

Ultimately I hope to automate the exchange of table
updates in Access via an automated process of sending and
receiving updates; then applying the updates to both
sides. For this test, I am not working from within
Access, just Outlook 2002.

Thanks
 
S

Sue Mosher [MVP]

Did you check your macro security in Tools | Macros | Security? Unsigned code won't run if the setting is High.

FWIW, Debug.Print would be better than MsgBox in your test routine.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
W

Walter

Thanks Sue,

I must confess, I have seen your work and your
participation in newsgroups and I had hoped you would
respond (you MVP you).

You're right on it. It worked fine (with several ominous
prompts). If I may have a few follow up questions:

1. If I access (via Access VBA/ Office Developer) the
Outlook Application, will I have to also look at the
Current User's Security Settings? Or will the code run
with no problems?

2. I understand that the scripting ability with the rules
wizard is new to Outlook 2002. If I use Access VB to
open earlier versions of Outlook and examine the inbox
for certain strings in the inbox, I assume that I could
delete any messages (spam) that do not meet the criterion
that I specify (i.e. Senders Name, subject, etc). Is
this also a security issue?

Thanks for your previous timely reply.

Regards,

Walter
 
S

Sue Mosher [MVP]

1) Since your latest messages doesn't include any of the original post, I don't have enough information to understand the context of the question.

2) Accessing sender information will trigger security prompts.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top