script in outlook

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
 
M

Milly Staples [MVP - Outlook]

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
 
N

Nite Rider

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
 

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