![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello,
I'm running Outlook 2003 and would like the ability to always allow read receipts from the users in my address book, but would like to choose whether to allow a read receipt or not from anyone else. I'm attempting to do this by setting the outlook settings to "always allow", but run the following a rule on all incoming emails not in my contact list: Sub PromptReadReceipt(MyMail As MailItem) Dim strID, Display, Title As String Dim olNS As Outlook.NameSpace Dim Msg As Outlook.MailItem Dim Style, Response Display = "Do you wish to allow a read receipt?" ' Define message. Style = vbYesNo ' Define buttons. Title = "Read Receipt Prompt" ' Define title. strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set Msg = olNS.GetItemFromID(strID) If Item.ReadReceiptRequested = True Then Response = Msgbox(Display, Style, Title) If Response = vbNo Then Item.ReadReceiptRequested = False Item.OriginatorDeliveryReportRequested = False Item.Update End If Else End If Else End If Set Msg = Nothing Set olNS = Nothing End Sub I'm not very familiar with outlook and it's VBA code requirements, so I Frankensteined this from code I found on multiple web pages and help menus. I was hoping someone more experienced than I could have a look for errors/loops before I try this out in Outlook. Thanks! |
Ads |
#2
|
|||
|
|||
![]()
Ammedment to code:
Knowing the email address of the sender would be useful to know before authorizing a read receipt so I changed: Display = "Do you wish to allow a read receipt?" ' Define message. to: Display = "Do you wish to allow a read receipt from " & Item.SenderEmailAddress & "?" Will this display the email address of the sender in the pop up box? Thanks! "prideoflions" wrote: Hello, I'm running Outlook 2003 and would like the ability to always allow read receipts from the users in my address book, but would like to choose whether to allow a read receipt or not from anyone else. I'm attempting to do this by setting the outlook settings to "always allow", but run the following a rule on all incoming emails not in my contact list: Sub PromptReadReceipt(MyMail As MailItem) Dim strID, Display, Title As String Dim olNS As Outlook.NameSpace Dim Msg As Outlook.MailItem Dim Style, Response Display = "Do you wish to allow a read receipt?" ' Define message. Style = vbYesNo ' Define buttons. Title = "Read Receipt Prompt" ' Define title. strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set Msg = olNS.GetItemFromID(strID) If Item.ReadReceiptRequested = True Then Response = Msgbox(Display, Style, Title) If Response = vbNo Then Item.ReadReceiptRequested = False Item.OriginatorDeliveryReportRequested = False Item.Update End If Else End If Else End If Set Msg = Nothing Set olNS = Nothing End Sub I'm not very familiar with outlook and it's VBA code requirements, so I Frankensteined this from code I found on multiple web pages and help menus. I was hoping someone more experienced than I could have a look for errors/loops before I try this out in Outlook. Thanks! |
#3
|
|||
|
|||
![]()
Am Wed, 24 May 2006 10:25:01 -0700 schrieb prideoflions:
Why don´t you simply test your solution yourself and ask if any errors occur? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Ammedment to code: Knowing the email address of the sender would be useful to know before authorizing a read receipt so I changed: Display = "Do you wish to allow a read receipt?" ' Define message. to: Display = "Do you wish to allow a read receipt from " & Item.SenderEmailAddress & "?" Will this display the email address of the sender in the pop up box? Thanks! "prideoflions" wrote: Hello, I'm running Outlook 2003 and would like the ability to always allow read receipts from the users in my address book, but would like to choose whether to allow a read receipt or not from anyone else. I'm attempting to do this by setting the outlook settings to "always allow", but run the following a rule on all incoming emails not in my contact list: Sub PromptReadReceipt(MyMail As MailItem) Dim strID, Display, Title As String Dim olNS As Outlook.NameSpace Dim Msg As Outlook.MailItem Dim Style, Response Display = "Do you wish to allow a read receipt?" ' Define message. Style = vbYesNo ' Define buttons. Title = "Read Receipt Prompt" ' Define title. strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set Msg = olNS.GetItemFromID(strID) If Item.ReadReceiptRequested = True Then Response = Msgbox(Display, Style, Title) If Response = vbNo Then Item.ReadReceiptRequested = False Item.OriginatorDeliveryReportRequested = False Item.Update End If Else End If Else End If Set Msg = Nothing Set olNS = Nothing End Sub I'm not very familiar with outlook and it's VBA code requirements, so I Frankensteined this from code I found on multiple web pages and help menus. I was hoping someone more experienced than I could have a look for errors/loops before I try this out in Outlook. Thanks! |
#4
|
|||
|
|||
![]()
I'm usually a big trial and error kind of person, but I'm a little leery when
it comes to messing around with the gears of program as important as outlook. I've never written a VB script for outlook before and half the code I'm using is added because I saw it was necessary in examples, not because I actually know what it does. That's hard to troubleshoot on your own. Is there any files worth backing up or things I can do to minimize any lasting issues? Are scripts harmless to play around with? Prideoflions "Michael Bauer" wrote: Am Wed, 24 May 2006 10:25:01 -0700 schrieb prideoflions: Why don´t you simply test your solution yourself and ask if any errors occur? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Ammedment to code: Knowing the email address of the sender would be useful to know before authorizing a read receipt so I changed: Display = "Do you wish to allow a read receipt?" ' Define message. to: Display = "Do you wish to allow a read receipt from " & Item.SenderEmailAddress & "?" Will this display the email address of the sender in the pop up box? Thanks! "prideoflions" wrote: Hello, I'm running Outlook 2003 and would like the ability to always allow read receipts from the users in my address book, but would like to choose whether to allow a read receipt or not from anyone else. I'm attempting to do this by setting the outlook settings to "always allow", but run the following a rule on all incoming emails not in my contact list: Sub PromptReadReceipt(MyMail As MailItem) Dim strID, Display, Title As String Dim olNS As Outlook.NameSpace Dim Msg As Outlook.MailItem Dim Style, Response Display = "Do you wish to allow a read receipt?" ' Define message. Style = vbYesNo ' Define buttons. Title = "Read Receipt Prompt" ' Define title. strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set Msg = olNS.GetItemFromID(strID) If Item.ReadReceiptRequested = True Then Response = Msgbox(Display, Style, Title) If Response = vbNo Then Item.ReadReceiptRequested = False Item.OriginatorDeliveryReportRequested = False Item.Update End If Else End If Else End If Set Msg = Nothing Set olNS = Nothing End Sub I'm not very familiar with outlook and it's VBA code requirements, so I Frankensteined this from code I found on multiple web pages and help menus. I was hoping someone more experienced than I could have a look for errors/loops before I try this out in Outlook. Thanks! |
#5
|
|||
|
|||
![]()
Am Thu, 25 May 2006 09:37:02 -0700 schrieb prideoflions:
The only error I can see is: - that the MailItem doesn´t support an Update method. instead is it called Save. - The method´s argument is called MyMail. Additionally you get the Msg variable from that (which is good due to the security model). But then you try to use the Item variable which is probably unkown. - After Item.Update it contains one End If too much. But that wouldn´t harm your data, it simply doesn´t run at all. Additionally, no errors but that could be done better: - The first Dim line doesn´t do what you´d expect. It declares the first two variables probably as Variant (default) and only the last variable as String. - If there´re no commands between an Else and the End If then you don´t need the Else statement. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- I'm usually a big trial and error kind of person, but I'm a little leery when it comes to messing around with the gears of program as important as outlook. I've never written a VB script for outlook before and half the code I'm using is added because I saw it was necessary in examples, not because I actually know what it does. That's hard to troubleshoot on your own. Is there any files worth backing up or things I can do to minimize any lasting issues? Are scripts harmless to play around with? Prideoflions "Michael Bauer" wrote: Am Wed, 24 May 2006 10:25:01 -0700 schrieb prideoflions: Why don´t you simply test your solution yourself and ask if any errors occur? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Ammedment to code: Knowing the email address of the sender would be useful to know before authorizing a read receipt so I changed: Display = "Do you wish to allow a read receipt?" ' Define message. to: Display = "Do you wish to allow a read receipt from " & Item.SenderEmailAddress & "?" Will this display the email address of the sender in the pop up box? Thanks! "prideoflions" wrote: Hello, I'm running Outlook 2003 and would like the ability to always allow read receipts from the users in my address book, but would like to choose whether to allow a read receipt or not from anyone else. I'm attempting to do this by setting the outlook settings to "always allow", but run the following a rule on all incoming emails not in my contact list: Sub PromptReadReceipt(MyMail As MailItem) Dim strID, Display, Title As String Dim olNS As Outlook.NameSpace Dim Msg As Outlook.MailItem Dim Style, Response Display = "Do you wish to allow a read receipt?" ' Define message. Style = vbYesNo ' Define buttons. Title = "Read Receipt Prompt" ' Define title. strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set Msg = olNS.GetItemFromID(strID) If Item.ReadReceiptRequested = True Then Response = Msgbox(Display, Style, Title) If Response = vbNo Then Item.ReadReceiptRequested = False Item.OriginatorDeliveryReportRequested = False Item.Update End If Else End If Else End If Set Msg = Nothing Set olNS = Nothing End Sub I'm not very familiar with outlook and it's VBA code requirements, so I Frankensteined this from code I found on multiple web pages and help menus. I was hoping someone more experienced than I could have a look for errors/loops before I try this out in Outlook. Thanks! |
#6
|
|||
|
|||
![]()
Thanks!
That's just the kind of look over I needed. I now how a little better understanding of the code I pieced together. I also changed "msg" with "Item" in the declared variables so the code is makes more sense now. I'm going to test out the script and if I encounter any further problems, I'll start a new thread. If it runs just like I want it, I'll post the completed code as general comments. "Michael Bauer" wrote: Am Thu, 25 May 2006 09:37:02 -0700 schrieb prideoflions: The only error I can see is: - that the MailItem doesn´t support an Update method. instead is it called Save. - The method´s argument is called MyMail. Additionally you get the Msg variable from that (which is good due to the security model). But then you try to use the Item variable which is probably unkown. - After Item.Update it contains one End If too much. But that wouldn´t harm your data, it simply doesn´t run at all. Additionally, no errors but that could be done better: - The first Dim line doesn´t do what you´d expect. It declares the first two variables probably as Variant (default) and only the last variable as String. - If there´re no commands between an Else and the End If then you don´t need the Else statement. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- I'm usually a big trial and error kind of person, but I'm a little leery when it comes to messing around with the gears of program as important as outlook. I've never written a VB script for outlook before and half the code I'm using is added because I saw it was necessary in examples, not because I actually know what it does. That's hard to troubleshoot on your own. Is there any files worth backing up or things I can do to minimize any lasting issues? Are scripts harmless to play around with? Prideoflions "Michael Bauer" wrote: Am Wed, 24 May 2006 10:25:01 -0700 schrieb prideoflions: Why don´t you simply test your solution yourself and ask if any errors occur? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Ammedment to code: Knowing the email address of the sender would be useful to know before authorizing a read receipt so I changed: Display = "Do you wish to allow a read receipt?" ' Define message. to: Display = "Do you wish to allow a read receipt from " & Item.SenderEmailAddress & "?" Will this display the email address of the sender in the pop up box? Thanks! "prideoflions" wrote: Hello, I'm running Outlook 2003 and would like the ability to always allow read receipts from the users in my address book, but would like to choose whether to allow a read receipt or not from anyone else. I'm attempting to do this by setting the outlook settings to "always allow", but run the following a rule on all incoming emails not in my contact list: Sub PromptReadReceipt(MyMail As MailItem) Dim strID, Display, Title As String Dim olNS As Outlook.NameSpace Dim Msg As Outlook.MailItem Dim Style, Response Display = "Do you wish to allow a read receipt?" ' Define message. Style = vbYesNo ' Define buttons. Title = "Read Receipt Prompt" ' Define title. strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set Msg = olNS.GetItemFromID(strID) If Item.ReadReceiptRequested = True Then Response = Msgbox(Display, Style, Title) If Response = vbNo Then Item.ReadReceiptRequested = False Item.OriginatorDeliveryReportRequested = False Item.Update End If Else End If Else End If Set Msg = Nothing Set olNS = Nothing End Sub I'm not very familiar with outlook and it's VBA code requirements, so I Frankensteined this from code I found on multiple web pages and help menus. I was hoping someone more experienced than I could have a look for errors/loops before I try this out in Outlook. Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Run a script" rule triggers but script does not execute | Trey Shaffer | Outlook and VBA | 7 | April 8th 06 12:34 AM |
Problem running a VBA script from an Outlook rule | Olivier Langlois | Add-ins for Outlook | 5 | March 16th 06 10:03 PM |
Message Rule Does Not Run VBA Procedure | Lowell | Outlook and VBA | 18 | March 9th 06 07:47 PM |
How to setup rule for delivery/read receipts ?? | Navinchandra Daund | Outlook - General Queries | 1 | January 31st 06 02:07 PM |
How to setup rule for delivery/read receipts ?? | Navinchandra Daund | Outlook - Installation | 0 | January 31st 06 07:13 AM |