当提醒触发时,Outlook 2010宏显示邮件

时间:2014-12-22 15:18:38

标签: vba email outlook outlook-vba outlook-2010

我设置了几个提醒功能,并希望显示不同的电子邮件,并在提醒触发时准备好发送。我知道如何做一个提醒,但有几个提出了无穷无尽的问题。

请查看我目前在下面的代码,我已经尝试了if else代码,但根本没有工作。目前这个只是没有拿起提醒信息。它给出了代码引用提醒信息的错误。

'Private Sub Application_Reminder(ByVal Item As Object)

Dim objMsg As MailItem

Set objMsg = Application.CreateItem(olMailItem)
If Item.MessageClass <> "IPM.Appointment" Then Exit Sub

If Item.Categories = "Branch Orders" Then Call BranchOrders
If Item.Categories = "Cust 1st Daily" Then Call CustDaily
If Item.Categories = "COH" Then Call COH
If Item.Categories = "Cust 1st Weekly" Then Call CustWeekly
If Item.Categories = "ATM Status And Avail" Then Call ATMSA

End Sub

Sub BranchOrders()
Dim objMsg As MailItem

Set objMsg = Application.CreateItem(olMailItem)

objMsg.To = Item.Location
objMsg.CC = ("bunch@hi.com")
objMsg.Subject = Item.Subject
objMsg.Body = Item.Body
objMsg.Display
Set objMsg = Nothing


End Sub


Sub CustDaily()
Dim objMsg As MailItem

Set objMsg = Application.CreateItem(olMailItem)

objMsg.To = Item.Location
objMsg.CC = ("afew@mails.com")
objMsg.Subject = Item.Subject
objMsg.Body = Item.Body
objMsg.Display
Set objMsg = Nothing


End Sub



Sub COH()
Dim objMsg As MailItem

Set objMsg = Application.CreateItem(olMailItem)

objMsg.To = Item.Location
objMsg.CC = ("just@one.com")
objMsg.Subject = Item.Subject
objMsg.Body = Item.Body
objMsg.Display
Set objMsg = Nothing


End Sub


Sub CustWeekly()
Dim objMsg As MailItem

Set objMsg = Application.CreateItem(olMailItem)

objMsg.To = Item.Location
objMsg.Subject = Item.Subject
objMsg.Body = Item.Body
objMsg.Display
Set objMsg = Nothing


End Sub


Sub ATMSA()
Dim objMsg As MailItem

Set objMsg = Application.CreateItem(olMailItem)

objMsg.To = Item.Location
objMsg.Subject = Item.Subject
objMsg.Body = Item.Body
objMsg.Display
Set objMsg = Nothing

End If

End Sub'

谢谢

1 个答案:

答案 0 :(得分:0)

看起来您需要处理Reminders类的BeforeReminderShow事件(请参阅Application.Reminders),以后不要显示任何邮件项。