打开“添加提醒..."使用 VBA 在 Outlook 中的邮件项目对话框? [英] Open "Add reminder..." dialog for mail item in Outlook using VBA?

查看:43
本文介绍了打开“添加提醒..."使用 VBA 在 Outlook 中的邮件项目对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Win10 64 位下使用 Outlook 2013 32 位.

Using Outlook 2013 32-bit under Win10 64-bit.

在 VBA 中,假设我有一个 mailitem 对象.我知道如果我想创建一个,我可以通过我自己的表单单独设置各种任务/提醒选项.如果我可以为邮件项目显示 Outlook 的添加提醒..."对话框,似乎会容易得多,但我没有找到任何对它的引用.

In VBA, suppose I have a mailitem object. I know I can set the various task/reminder options individually through my own form if I want to create one. It seems like it would be a lot easier if I could cause Outlook's "Add reminder ..." dialog to display for the mail item, but I haven't found any references to it.

这是出现在 Outlook 中的对话框:

This is the dialog as it appears in the Outlook:

(顺便说一句,我可以使用 myMailItem.ShowCategoriesDialog 来显示类别对话框,但似乎没有类似的提醒.)

(As an aside, I can get the Categories dialog to come up using myMailItem.ShowCategoriesDialog, but there doesn't seem to be anything similar for reminders.)

谢谢!

推荐答案

当您单击功能区上的添加提醒"对话框按钮时,它会根据处于活动状态的窗口执行操作并绑定提醒对象(和/或跟随up 对象等)到邮件项目.

When you click the Add Reminder dialog box button on the ribbon, depending on what window is active it will act and will tie the reminder object (and/or follow up object etc) to a mail item.

如果您没有打开邮件项目,它会将其与收件箱中选择的邮件项目(一个或多个)相关联,默认情况下仅选择一个项目,该项目以灰色或浅蓝色背景突出显示.您可以按住 CTRL 键并选择更多邮件项目,然后单击添加提醒将提醒应用到所有这些项目.

If you have no mail item open it will tie it to the mail items that are selected in the inbox (one or more), By default only one item is selected, which is highlighted with a gray or light blue background. You can hold the CTRL key down and select more mail items and then click the Add Reminder to apply the reminder to all of those items.

如果邮件项目已打开并处于活动状态,则提醒将仅应用于该邮件项目.对于您似乎想要一个一个应用提醒的情况,我们将采用后一种方法.找到我们想要的邮件项然后打开它,然后打开添加提醒对话框,当你点击确定时,它会保存它并关闭活动窗口.此代码查找最近的邮件项目,但您应该能够更改选择条件:

If a mail item is already open and active then the reminder will be applied only to that mail item. For your case that it seems you want to apply the reminders one by one we will go with the latter method. Find the mail item we want and then open it, and then open the Add Reminder dialog box, and when you hit ok, it will save it and close the active window. This code finds the most recent mail item, but you should be able to change the selection criteria:

Private Sub PopUpReminderDialogBox()
    Dim iLatest As Long
    Dim myFolder As Object
    Dim myNameSpace As Object
    Dim myItem As Outlook.MailItem
    Dim olApp As Outlook.Application

    Set olApp = Outlook.Application 'you can initiate a New application too
    Set myNameSpace = olApp.GetNamespace("MAPI")
    Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)

    iLatest = myFolder.Items.Count
    Set myItem = myFolder.Items(iLatest)

    myItem.Display 'to make the mailitem currentitem
    olApp.ActiveInspector.CommandBars.ExecuteMso ("AddReminder")
    myItem.Close olSave
End Sub

如果您想在收件箱中突出显示一个或多个邮件项目时有机会打开提醒对话框,那么您需要使用

If you wanted by any chance to open up the reminder dialog box when one or more mail item is highlighted in the inbox, then you need to use

    olApp.ActiveExplorer.CommandBars.ExecuteMso ("AddReminder")

代替

    olApp.ActiveInspector.CommandBars.ExecuteMso ("AddReminder")

这篇关于打开“添加提醒..."使用 VBA 在 Outlook 中的邮件项目对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆