【发布时间】:2018-03-06 10:48:51
【问题描述】:
我使用 VBA 发送电子邮件。每封电子邮件都会弹出一个分类,需要手动设置。我正在尝试在代码中解决这个问题。
我找到了发送电子邮件的代码:Mail a message with outlook via VBA。
在修复了一些东西之后,下面的代码就可以工作了。
Sub sendEmail()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Reminder"
.Body = "Dear " & Cells(cell.Row, "A").Value _
& vbNewLine & vbNewLine & _
"Please Finish your course " & Cells(cell.Row, "C") & _
" before expiry date."
.Send 'Or use Display
End With
On Error GoTo 0
Set OutMail = Nothing
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
问题是,从列表中向例如 10 个人发送电子邮件后,我需要点击分类弹出 10 次。
我发现了这个:How to save workbook and handle TITUS (or any other document classification add-in) popup?
我在.Send 之前尝试过.EnableEvents = False。我不确定这是否对我有用。
在我的情况下如何使用它?是否可以禁用它、解决它,甚至在代码中设置一个分类?
【问题讨论】:
-
它是 Outlook 或 Excel 的加载项吗?您是否尝试过至少在代码执行期间完全禁用加载项?
-
@AntiDrondert 它由公司为所有 Microsoft Office 应用程序安装。来处理信息。不能禁用。由outlook在外发电子邮件上完成的弹出窗口。
-
您需要更改 TITUS 的设置。联系您的管理员并告诉他们您在做什么。