Re: Help for a novice
- From: "Sue Mosher [MVP-Outlook]" <suemvp@xxxxxxxxxxxxxxx>
- Date: Tue, 21 Feb 2006 13:39:30 -0500
I don't see any code yet to instantiate colInsp. If you want the whole routine to run automatically, you need code in the Application_Startup event handler in ThisOutlookSession to handle that.
As I said in my earlier post, if you check the value of the message's Sent property and it equals False, then you know you have a reply, forward, or new message, one that you don't want to process.
Other issues:
Outlook VBA includes an intrinsic Application object, so you don't need to use CreateObject to create another one.
Also, you said "users." Outlook VBA code is not meant to be redistributed. Ultimately, you should be thinking about building this functionality into an OUtlook COM add-in. See http://www.outlookcode.com/d/comaddins.htm
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"SuperSlueth" <np121@xxxxxxxxxxx> wrote in message news:sikmv15s31aq622aj03eiamiab4chii3qq@xxxxxxxxxx
The code that you suggested, when does it run .....
I mean does the user have to do something or does this code run when a
new mail comes in.
The users here don't want the attachments for every mail to open. only
when the user opens it to read.
Quite often we get unwanted or duplicate mails with attachements ...
the user just wants to delete these without the attachments opening
Thanks for you continued help
I've included my code for your information
This is the code so far
Code in "ThisOutlookSession"
Dim WithEvents colInsp As Outlook.Inspectors
Public WithEvents myItem As Outlook.MailItem
Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
Call Att_Open
End Sub
Code in Module ....
It runs fine when an email is opened to read, but also runs when the
user selects Reply. ReplyAll forward or New .... which i need to stop
Sub Att_Open()
Dim myolApp As Outlook.Application
Dim myinspector As Outlook.Inspector
Set myolApp = CreateObject("Outlook.Application")
Set myinspector = myolApp.ActiveInspector
Dim I As Integer
If TypeName(myinspector) = "Nothing" Then
Exit Sub
ElseIf Application.ActiveInspector.CurrentItem.Attachments.Count =
0 Then
MsgBox "No Attachments"
ElseIf Application.ActiveInspector.CurrentItem.Attachments.Count >
0 Then
I = Application.ActiveInspector.CurrentItem.Attachments.Count
MsgBox I
End If
End Sub
On Tue, 21 Feb 2006 11:53:32 -0500, "Sue Mosher [MVP-Outlook]"
<suemvp@xxxxxxxxxxxxxxx> wrote:
Take a look at http://www.outlookcode.com/codedetail.aspx?id=1140. Check the message's Sent property equals False, then you know you have a reply, forward, or new message.
Note that this has nothing to do with custom forms.
- Follow-Ups:
- Re: Help for a novice
- From: SuperSlueth
- Re: Help for a novice
- References:
- Help for a novice
- From: SuperSlueth
- Re: Help for a novice
- From: Sue Mosher [MVP-Outlook]
- Re: Help for a novice
- From: SuperSlueth
- Re: Help for a novice
- From: Sue Mosher [MVP-Outlook]
- Re: Help for a novice
- From: SuperSlueth
- Help for a novice
- Prev by Date: Re: Help for a novice
- Next by Date: Re: Help for a novice
- Previous by thread: Re: Help for a novice
- Next by thread: Re: Help for a novice
- Index(es):
Relevant Pages
|