我使用以下代码将文件发送到我自己创建的Outlook联系人组,该联系人组具有唯一的名称,例如"列出欧洲":
Public Function Sendout(strRecipients As String, strSubject As String,
strPDF As String) As Boolean
Dim wbCC As Workbook
Dim wsMain As Worksheet
Dim wsSO As Worksheet
Set wbCC = Workbooks("Control-Center.xlsm")
Set wsMain = wbCC.Worksheets("Main")
Set wsSO = wbCC.Worksheets("Sendout")
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
If strPDF <> "" Then
wsSO.Activate
wsSO.Range("A1:B1").Select
With Selection
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = strRecipients
.Item.Subject = strSubject & strDate
.Item.Attachments.Add strPDF
.Item.Send
End With
ActiveWorkbook.EnvelopeVisible = False
End With
With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
Sendout = True
Else: Sendout = False
End If
End Function
运行我的代码时,&#34;检查名称&#34;弹出框并提供的不仅仅是我移交给我的函数的列表,还有其他包含单词&#34; List&#34;和/或&#34;欧洲&#34;,例如&#34;欧洲第二个名单&#34;。
我的问题是,如何压制此弹出窗口并强制代码使用我所交付的内容?在Outlook中操作设置 - 理论上 - 可以禁用此类消息并不会导致任何成功。
谢谢!
答案 0 :(得分:1)
不要为收件人使用名称。使用SMTP地址 - 它们始终是明确解析的。