有没有办法在 VBA 中添加特定类别并标记电子邮件?

发布于 2024-08-11 18:15:41 字数 164 浏览 4 评论 0原文

我通常会浏览我的电子邮件并标记任何要跟进的内容并分类为:

  1. 电话呼叫
  2. 电子邮件
  3. 通话
  4. 设置会议

在 Outlook VBA 宏中是否有任何方法,我可以(在单个宏中)标记要跟踪的项目并设置就以上类别之一吗?

I normally go through my email and flag anything for follow up and categorize for:

  1. Phone Call
  2. Email
  3. Talk To
  4. Setup meeting

Is there any way in a Outlook VBA macro, I can (in a single macro), both flag an item for follow and set one of the above categories on it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵山崖 2024-08-18 18:15:41

我已经找到答案了。 .列出如下。 。 。

Private Sub TagArchived1(category As String)

    Dim objOutlook As Outlook.Application
    Dim objInspector As Outlook.Inspector

    Dim strDateTime As String

    ' Instantiate an Outlook Application object.
    Set objOutlook = CreateObject("Outlook.Application")

    ' The ActiveInspector is the currently open item.
    Set objExplorer = objOutlook.ActiveExplorer

    ' Check and see if anything is open.
    If Not objExplorer Is Nothing Then
        ' Get the current item.
        Dim arySelection As Object
        Set arySelection = objExplorer.Selection

        For x = 1 To arySelection.Count
            Dim m As MailItem
            Set m = arySelection.Item(x)
            m.Categories = category
            m.FlagStatus = olFlagMarked
            m.FlagIcon = 6
            m.Save
        Next x

    Else
        ' Show error message with only the OK button.
        MsgBox "No explorer is open", vbOKOnly
    End If

    ' Set all objects equal to Nothing to destroy them and
    ' release the memory and resources they take.
    Set objOutlook = Nothing
    Set objExplorer = Nothing
End Sub

I have found the answer . .listed below . . .

Private Sub TagArchived1(category As String)

    Dim objOutlook As Outlook.Application
    Dim objInspector As Outlook.Inspector

    Dim strDateTime As String

    ' Instantiate an Outlook Application object.
    Set objOutlook = CreateObject("Outlook.Application")

    ' The ActiveInspector is the currently open item.
    Set objExplorer = objOutlook.ActiveExplorer

    ' Check and see if anything is open.
    If Not objExplorer Is Nothing Then
        ' Get the current item.
        Dim arySelection As Object
        Set arySelection = objExplorer.Selection

        For x = 1 To arySelection.Count
            Dim m As MailItem
            Set m = arySelection.Item(x)
            m.Categories = category
            m.FlagStatus = olFlagMarked
            m.FlagIcon = 6
            m.Save
        Next x

    Else
        ' Show error message with only the OK button.
        MsgBox "No explorer is open", vbOKOnly
    End If

    ' Set all objects equal to Nothing to destroy them and
    ' release the memory and resources they take.
    Set objOutlook = Nothing
    Set objExplorer = Nothing
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文