script in outlook

  • Thread starter Thread starter Nite Rider
  • Start date Start date
N

Nite Rider

Hi,
I found a script that checks for attachments and modified it a little to
block any attachment from being sent. I push alt + F11 and open Visual Basic
and put it in ThisOutlookSession. The script runs until I restart outlook at
which point it no longer runs later until I redo it. Does anyone know what's
going on.

Here is the script:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim intRes As Integer

Dim strMsg As String


If Item.Attachments.Count > 0 Then

strMsg = "You are not allowed to send e-mail containing attachments. The
e-mail will not be sent untill the attachment is removed."

intRes = MsgBox(strMsg, vbExclamation, "Attachment Disallowed")

If Item.Attachments.Count > 0 Then

' cancel send

Cancel = True

End If

End If

End Sub
 
Have you asked the author of the script for assistance??

--
Milly Staples [MVP - Outlook]

Post all replies to the group to keep the discussion intact. Due to
the SWEN virus, all mail sent to my personal account will be deleted
without reading.

After searching google.groups.com and finding no answer, Nite Rider asked:

| Hi,
| I found a script that checks for attachments and modified it a little
| to block any attachment from being sent. I push alt + F11 and open
| Visual Basic and put it in ThisOutlookSession. The script runs until
| I restart outlook at which point it no longer runs later until I redo
| it. Does anyone know what's going on.
|
| Here is the script:
| Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
| Boolean)
|
| Dim intRes As Integer
|
| Dim strMsg As String
|
|
| If Item.Attachments.Count > 0 Then
|
| strMsg = "You are not allowed to send e-mail containing
| attachments. The e-mail will not be sent untill the attachment is
| removed."
|
| intRes = MsgBox(strMsg, vbExclamation, "Attachment Disallowed")
|
| If Item.Attachments.Count > 0 Then
|
| ' cancel send
|
| Cancel = True
|
| End If
|
| End If
|
| End Sub
 
Hi again,

I got the script to not disappear upon restarting outlook. It ends up
due to security implemented on outlook it will not read a VBA project
that is not digitally signed and trusted by the computer. So I used
selfcert.exe which comes with MS Office and created a certificate, and
copied it to trusted root certificate directory using certificate
management via mmc. Then I signed the project in Visual Basic and it
works from now on.

Nite Rider
 
Back
Top