[mso] Re: Rules don't rule

  • From: "Greg Chapman" <greg@xxxxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Tue, 7 Oct 2003 13:55:44 -0500

Aha!!! I see what you mean with the On Error business and that's a problem
only because no one ever writes about how to actually use that error
handling method correctly. I'm with you; an error is an opportunity to
make a conditional decision if you can understand the error. So, that in
mind, look at this method of using On Error Resume Next.

On Error Resume Next

Set This=ThatObject.Class
If Err <> 0 Then
        debug.print "Holy Hex Code, Batman!! Whatever could that error
be?"
        Debug.Print Err.Number & ", " & Err.Description
        'Make some decision based on Err.Number here
        Select Case Err.Number
        Case 70
                Debug.Print "Access Denied!"
                Err.Clear
                'Go to some authentication
                'method you've written and retry
                LogMeIN
        Case Else
                'Didn't know about this error so I want it written
                'down by my logging routine
                LogAction Err.Number & ", " & Err.Description
                LogAction "This Subroutine failed!"
        End Select
        Err.Clear
End If

'go back to good ole
'standard error handling
On Error GoTo 0

The Spam tool I was walking about is SpamBayes
(http://www.sourceforge.net/projects/spambayes)

> Key to this though is being able to run a macro from a rule.
> I've tried to
> do this but I'm stuck when I get to the wizard part for
> "custom action".
> Have you any clue as to how I set up the wizard to say run
> this macro?

Nope, but I know I'd also like to do something like this and add the
condition that there is an attachment since many of these NDR have the
original, infected file, included in the message.

>I'd
> like to be able to "... run now" a macro really. Also, do you
> know if it's
> possible for a message to have a body *and* a html body?
Go to Tools Macros? Customize the Toolbar to have a button pointing at
your macro?

> BTW I really like the code in your reply. If you have no
> objections I'm
> going to use some of it with appropriate credit of course.
No need for that. I was just browsing the object browser while chasing
through your code. <g>

>I
> think using
> olFormatHTML and olFormatPlain is great. At the moment I'm using...
> .........
> slHTML = oItem.HTMLBody
> If Trim(slHTML) <> "" Then
> .........
>
> Which I feel a bit icky about.... Same as using option
> explicit I suppose
Option Explicit is fine with a couple painful exceptions. To me, Option
Explicit is there only for the programmer who is forgetful (uh, what's
your name again?). It can reduce the number of bugs you have as the result
of typos but it really doesn't do much but force the declaration of a
variable. It doesn't even demand that you strongly data type your variable
declaration. That part remains up to you as a bit of discipline which also
can cause you to tear hair out (and usually without need). Also, there
instances as you move across the VB language types where Option Explicit
actually defeats some of your error handling. For that reason alone you'll
rarely find an experienced VBScripter who will use Error Handling AND
Option Explicit in the same script.

Greg Chapman
http://www.mousetrax.com
"Counting in binary is as easy as 01, 10, 11!
With thinking this clear, is coding really a good idea?"


> -----Original Message-----
> From: mso-bounce@xxxxxxxxxxxxx
> [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf Of Green
> Sent: Tuesday, October 07, 2003 2:34 PM
> To: mso@xxxxxxxxxxxxx
> Subject: [mso] Re: Rules don't rule
>
>
> Hi Greg,
>
> I'v just got a bee in my bonnet that's all. It started with
> me trying to
> make a rule to pick out words in emails and move them to a folder.
> Specifically "undelivered" and undeliverable. I'm so upset by
> these because
> I'm getting so many! Anyway the rule worked for some mails
> and not others so
> I got a bit curious and as I said in previous posting I'm a
> stubborn ...
> person :-)
>

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: