简体   繁体   English

在从 Excel 发送之前如何在 Outlook 中对电子邮件进行分类

[英]How to classify e-mail in Outlook before sending from Excel

I've got a macro in Excel that send e-mail through Outlook and it works perfectly.我在 Excel 中有一个宏,可以通过 Outlook 发送电子邮件,并且运行良好。 But in my company they recently added an e-mail classification.但是在我的公司,他们最近添加了电子邮件分类。 Can I insert on my code?我可以插入我的代码吗?

Example: If send 2.000 e-mails at once, I'll have to click 2.000 times on any of the classification button.示例:如果一次发送 2.000 封电子邮件,我将不得不在任何分类按钮上单击 2.000 次。

The language is in Portuguese (Brazil), so by order is: Confidential, Reserved, Internal, Public.语言是葡萄牙语(巴西),所以按顺序是:机密、保留、内部、公共。

Classification:分类:

分类示例

    Sub ContatoAtivo()

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    Dim OutlookApp As Object
    Dim OutlookMail As Object
    Dim xTexto As String
    Dim Texto As String
    Dim X, Y, Z As Integer
    Dim Email As String
    Dim Assunto As String
    Dim Qtd As Integer
    Dim rng As Range

    Qtd = Planilha2.ListObjects(1).DataBodyRange.Rows.Count

    For X = 1 To 1
        Email = Planilha2.Cells(X + 6, 8).Value
        Subject = Planilha3.Cells(11, 1).Value

        If Email <> "" Then

            Set rng = Nothing
            Set rng = Planilha3.Range("E12:F22").SpecialCells(xlCellTypeVisible)

            Set OutlookApp = CreateObject("Outlook.Application")
            Set OutlookMail = OutlookApp.CreateItem(0)

            Text = "Test"

            With OutlookMail
                .To = "test.test@test.com.br"
                .CC = ""
                .BCC = ""
                .Subject = Planilha3.Range("A5").Value & " | " & Subject
                .HTMLBody = Text
                '.Display
                .Send

            End With

            Set OutlookMail = Nothing
            Set OutlookApp = Nothing

            Texto = ""

        End If

    Next X

    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
End Sub

Thanks!谢谢!

These controls belong to the Azure Information Protection add-in.这些控件属于 Azure 信息保护加载项。 Unfortunately, Office (nor VBA or VSTO) doesn't provide any trivial way for customizing a custom UI or dealing with it.不幸的是,Office(也不是 VBA 或 VSTO)没有提供任何用于自定义自定义 UI 或处理它的简单方法。 Your options are listed below:您的选择如下:

  1. Try to use the CommandBars.ExecuteMso method which executes the control identified by the idMso parameter.尝试使用CommandBars.ExecuteMso方法执行由idMso参数标识的idMso You must find the ID of controls you need to launch programmatically.您必须找到以编程方式启动所需的控件的 ID。
  2. Ask or find the command which is run by clicking the corresponding button in the UI.询问或查找通过单击 UI 中的相应按钮运行的命令。 Note, you can use a late biding technology for that.请注意,您可以为此使用延迟投标技术。 So, you could call the method from VBA.因此,您可以从 VBA 调用该方法。 Read more about that in the Walkthrough: Call code in a VSTO Add-in from VBA article.演练:从 VBA 中调用 VSTO 外接程序中的代码一文中了解更多相关信息。
  3. Use Microsoft Active Accessibility API.使用Microsoft Active Accessibility API。 Microsoft Active Accessibility is a Component Object Model (COM)-based technology that improves the way accessibility aids work with applications running on Microsoft Windows. Microsoft Active Accessibility 是一种基于组件对象模型 (COM) 的技术,它改进了辅助功能与在 Microsoft Windows 上运行的应用程序一起工作的方式。 It provides dynamic-link libraries that are incorporated into the operating system as well as a COM interface and API elements that provide reliable methods for exposing information about UI elements.它提供了集成到操作系统中的动态链接库以及一个 COM 接口和 API 元素,它们提供了用于公开 UI 元素信息的可靠方法。

Anyway, I'd suggest contacting AIP add-in developers.无论如何,我建议联系 AIP 插件开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM