A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Selective Read Receipts VBA using run a script rule



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 24th 06, 04:30 PM posted to microsoft.public.outlook.program_vba
prideoflions
external usenet poster
 
Posts: 6
Default Selective Read Receipts VBA using run a script rule

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  
Old May 24th 06, 07:25 PM posted to microsoft.public.outlook.program_vba
prideoflions
external usenet poster
 
Posts: 6
Default Selective Read Receipts VBA using run a script rule

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  
Old May 25th 06, 09:41 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Selective Read Receipts VBA using run a script rule

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  
Old May 25th 06, 06:37 PM posted to microsoft.public.outlook.program_vba
prideoflions
external usenet poster
 
Posts: 6
Default Selective Read Receipts VBA using run a script rule

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  
Old May 26th 06, 09:44 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Selective Read Receipts VBA using run a script rule

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  
Old May 26th 06, 04:31 PM posted to microsoft.public.outlook.program_vba
prideoflions
external usenet poster
 
Posts: 6
Default Selective Read Receipts VBA using run a script rule

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 08:17 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-2025 Outlook Banter.
The comments are property of their posters.