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!