![]() |
Help for a novice
I've read the help on reply event , but can't get it to work
I've tried placing this everywhere but I can't get it to run when the user sends a reply. I'm trying to find the right place to set the code so that only runs when the user sends a reply PLEASE can anyone help Public WithEvents myItem As MailItem Sub Initialize_Handler() Set myItem = Application.ActiveInspector.CurrentItem End Sub Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean) MsgBox "Reply" End Sub |
Help for a novice
We're confused, too. You've posted in a forum about Outlook custom forms, which use VBScript as their code language, but the topic of your post seems to deal with VBA/VB code. Please give us the "big picture" so we can understand what you're trying to do.
-- 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've read the help on reply event , but can't get it to work I've tried placing this everywhere but I can't get it to run when the user sends a reply. I'm trying to find the right place to set the code so that only runs when the user sends a reply PLEASE can anyone help Public WithEvents myItem As MailItem Sub Initialize_Handler() Set myItem = Application.ActiveInspector.CurrentItem End Sub Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean) MsgBox "Reply" End Sub |
Help for a novice
I have users that get faxes as email attachments.
Sometimes as many as 6 or 7 per email, as GIF attachments. Outlook 2003 doesn't allow you to open multiple attachments at 1 time. I'm trying to write a VBA macro that opens all the attachments when the user opens the email. I don't want to open the attachments when the user uses Reply, Reply All, or Forward. So I need to test for these and block those events I only want to open the attachments when the user opens the eamil to read. All the code I've seen on the interent either opens attachments on new mails as they come in or search the inbox for attachments and opens them all Maybe you have a simple solution to this seemingly easy task On Tue, 21 Feb 2006 08:58:35 -0500, "Sue Mosher [MVP-Outlook]" wrote: We're confused, too. You've posted in a forum about Outlook custom forms, which use VBScript as their code language, but the topic of your post seems to deal with VBA/VB code. Please give us the "big picture" so we can understand what you're trying to do. |
Help for a novice
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. -- 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 have users that get faxes as email attachments. Sometimes as many as 6 or 7 per email, as GIF attachments. Outlook 2003 doesn't allow you to open multiple attachments at 1 time. I'm trying to write a VBA macro that opens all the attachments when the user opens the email. I don't want to open the attachments when the user uses Reply, Reply All, or Forward. So I need to test for these and block those events I only want to open the attachments when the user opens the eamil to read. All the code I've seen on the interent either opens attachments on new mails as they come in or search the inbox for attachments and opens them all Maybe you have a simple solution to this seemingly easy task On Tue, 21 Feb 2006 08:58:35 -0500, "Sue Mosher [MVP-Outlook]" wrote: We're confused, too. You've posted in a forum about Outlook custom forms, which use VBScript as their code language, but the topic of your post seems to deal with VBA/VB code. Please give us the "big picture" so we can understand what you're trying to do. |
Help for a novice
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.Attachment s.Count = 0 Then MsgBox "No Attachments" ElseIf Application.ActiveInspector.CurrentItem.Attachment s.Count 0 Then I = Application.ActiveInspector.CurrentItem.Attachment s.Count MsgBox I End If End Sub On Tue, 21 Feb 2006 11:53:32 -0500, "Sue Mosher [MVP-Outlook]" 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. |
Help for a novice
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" wrote in message ... 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.Attachment s.Count = 0 Then MsgBox "No Attachments" ElseIf Application.ActiveInspector.CurrentItem.Attachment s.Count 0 Then I = Application.ActiveInspector.CurrentItem.Attachment s.Count MsgBox I End If End Sub On Tue, 21 Feb 2006 11:53:32 -0500, "Sue Mosher [MVP-Outlook]" 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. |
Help for a novice
I have no experience in building COMs add-ins. I'm not a programmer and had this landed on me. On Tue, 21 Feb 2006 13:39:30 -0500, "Sue Mosher [MVP-Outlook]" wrote: 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 |
Help for a novice
Then I'd advise you to go back to the person who assigned the project and explain to them that you might need some outside help.
-- 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 have no experience in building COMs add-ins. I'm not a programmer and had this landed on me. On Tue, 21 Feb 2006 13:39:30 -0500, "Sue Mosher [MVP-Outlook]" wrote: 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 |
Help for a novice
Partly my own fault opening mi mouth and saying it shouldn't be that
difficult to do. .... learnt my lesson anyway. do you have some code that explains how to test for the sent property I've tried Set myItem = ActiveInspector MsgBox myItem ..... returns the subject of the mail If myItem.Sent = False Then But i get an error " The obect doesn't support this method or property" can you help please |
Help for a novice
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. -- 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 ... Partly my own fault opening mi mouth and saying it shouldn't be that difficult to do. .... learnt my lesson anyway. do you have some code that explains how to test for the sent property I've tried Set myItem = ActiveInspector MsgBox myItem ..... returns the subject of the mail If myItem.Sent = False Then But i get an error " The obect doesn't support this method or property" can you help please |
All times are GMT +1. The time now is 08:31 PM. |
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