View Single Post
  #11  
Old February 23rd 06, 04:19 PM posted to microsoft.public.outlook.program_forms
SuperSlueth
external usenet poster
 
Posts: 24
Default Help for a novice

I tried

f myItem.Class = olMail Then
If myItem.Sent = True Then

MsgBox "Test"

' it's not a newly created item
' put your code to work with myItem here
End If
End If


The msgbox pops up when a mail is opened for reading the first time,
also when the user selects reply, replyall or forward


I need something that ONLY works when the mail is opened for reading
.....not when a reply, reply all or forward is selected


On Tue, 21 Feb 2006 17:55:11 -0500, "Sue Mosher [MVP-Outlook]"
wrote:

The problem with your code below is that ActiveInspector is not an item. It's just the window showing an item. In VBA, if you want the item, you use:

Set myItem = Application.ActiveInspector.CurrentItem

Because the Sent property is specific to the MailItem object, you should check that myItem is a MailItem before you do anything else. Then you can check the value of the Sent property:

If myItem.Class = olMail Then
If myItem.Sent = True Then
' it's not a newly created item
' put your code to work with myItem here
End If
End If

See http://www.outlookcode.com/d/propsyntax.htm for a basic primer on Outlook property syntax.

Ads