![]() |
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. |
Help for a novice
How are you instantiating myItem?
I can't duplicate the results here on OUtlook 2003. THis is all my code: Dim WithEvents colInsp As Inspectors Private Sub Application_Startup() Set colInsp = Application.Inspectors End Sub Private Sub colInsp_NewInspector(ByVal Inspector As Inspector) Set itm = Inspector.CurrentItem If itm.Class = olMail Then If itm.Sent = True Then MsgBox "It's not a new item" End If End If End Sub -- 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" wrote in message ... 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. |
Help for a novice
OK, lets take a differnent approach
I've seen "Reply event" Is there any way in VBA to see if theis event has happened. What I read it as if the user selects reply, then i should be able to test to see if this event is "True or False" many thanks 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. |
Help for a novice
Handling the Reply event is ***much*** more difficult because the message you can reply to changes every time you open an item or change your selection in the folder. THat requires a wrapper class; see http://www.outlookcode.com/d/vb.htm#wrapper
Did you try my code? -- 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" wrote in message ... OK, lets take a differnent approach I've seen "Reply event" Is there any way in VBA to see if theis event has happened. What I read it as if the user selects reply, then i should be able to test to see if this event is "True or False" many thanks 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. |
Help for a novice
Yes I tried your code, but it works on open mail (read), as well as
reply, replyall, & forward If I use it as is, the attachments will open everytime the user selects reply, replyall or forward ...... not very convenient I'm looking for a way that it only works when the user opens a mail to read... it shouldn't work anywhere else On Thu, 23 Feb 2006 12:19:29 -0500, "Sue Mosher [MVP-Outlook]" wrote: Handling the Reply event is ***much*** more difficult because the message you can reply to changes every time you open an item or change your selection in the folder. THat requires a wrapper class; see http://www.outlookcode.com/d/vb.htm#wrapper Did you try my code? |
Help for a novice
It works fine here. Did you use exactly the code I posted? If not, show what you're using. Also, try stepping through it to see what's not working for you.
-- 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" wrote in message ... Yes I tried your code, but it works on open mail (read), as well as reply, replyall, & forward If I use it as is, the attachments will open everytime the user selects reply, replyall or forward ...... not very convenient I'm looking for a way that it only works when the user opens a mail to read... it shouldn't work anywhere else On Thu, 23 Feb 2006 12:19:29 -0500, "Sue Mosher [MVP-Outlook]" wrote: Handling the Reply event is ***much*** more difficult because the message you can reply to changes every time you open an item or change your selection in the folder. THat requires a wrapper class; see http://www.outlookcode.com/d/vb.htm#wrapper Did you try my code? |
Help for a novice
In desperation I did a machine cleanup including the following
removed ALL vba code from outlook ran Office repair ran Scanpst ... errors found deleted all caches and temps ... 134Mb removed ran regcleaner..... 207 errors found and repaird or removed reboot with scandisk checked for and installed updates for windows & office .... 3 found defragged hadrdisk added your code to outlook and it works now not sure of the exact reason but at last got it to work Thanks for all your help On Thu, 23 Feb 2006 18:17:07 -0500, "Sue Mosher [MVP-Outlook]" wrote: It works fine here. Did you use exactly the code I posted? If not, show what you're using. Also, try stepping through it to see what's not working for you. |
Help for a novice
I'm trying the following
Set myItem = Application.ActiveInspector.CurrentItem Set myAttachments = myItem.Attachments MsgBox myAttachments.Item(1).DisplayName This displays the attachments files name ok but when I try myAttachments.Item(1).Open I get an error The attachmenats are GIF files and when I double click on an attachment it opens with windows picture and fax viewer OK Where am i going wrong with my code and is there a simple way in VBA to open this type of attachment. |
Help for a novice
You can't open an attachment that way (and you'd know that if you looked in the object browser at the Attachment object; it has no Open method). You must save each attachment first to your hard drive and then open it, either with the appropriate automation for that type of file or with a Shell Execute type of command. See http://www.outlookcode.com/codedetail.aspx?id=1140 for a code sample.
You might also enjoy Eric's sample at http://msdn.microsoft.com/library/en...PictAttach.asp -- 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" wrote in message ... I'm trying the following Set myItem = Application.ActiveInspector.CurrentItem Set myAttachments = myItem.Attachments MsgBox myAttachments.Item(1).DisplayName This displays the attachments files name ok but when I try myAttachments.Item(1).Open I get an error The attachmenats are GIF files and when I double click on an attachment it opens with windows picture and fax viewer OK Where am i going wrong with my code and is there a simple way in VBA to open this type of attachment. |
Help for a novice
Sorry I don't follow
If I double click on the attachment it opens without saving it to disk therefore why can't it just be opend with code On Fri, 24 Feb 2006 18:24:12 -0500, "Sue Mosher [MVP-Outlook]" wrote: You can't open an attachment that way (and you'd know that if you looked in the object browser at the Attachment object; it has no Open method). You must save each attachment first to your hard drive and then open it, either with the appropriate automation for that type of file or with a Shell Execute type of command. See http://www.outlookcode.com/codedetail.aspx?id=1140 for a code sample. You might also enjoy Eric's sample at http://msdn.microsoft.com/library/en...PictAttach.asp |
All times are GMT +1. The time now is 07:51 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com