Excel VBA:禁止“检查名称”发送邮件时的框 [英] Excel VBA: Suppress "Check Names" box when sending mails

查看:111
本文介绍了Excel VBA:禁止“检查名称”发送邮件时的框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Forum,

我使用以下代码将文件发送到我自己创建的Outlook联系人组,该联系人组具有唯一的名称,例如"List Europe":

I am using the following code to send a file to an Outlook contact group I created myself which has a unique name, e.g. "List Europe":

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

运行我的代码时,"检查​​名称"弹出框并提供的不仅仅是我移交给我的函数的列表,而是包含单词"List"的其他列表。和/或"欧洲",例如"欧洲第二名单"。

When running my code, the "Check names" box pops up and offers more than just the list I handed over to my function, but other lists containing the words "List" and/or "Europe", e.g. "Europe second list".

我的问题是,如何禁止弹出窗口并强制代码使用我所移​​交的内容?

My question is, how can I suppress this pop-up and force the code to use just exactly what I handed over?

谢谢!

推荐答案

以下是VBA论坛。你现在的这个是VB for .Net

This bellow is the VBA forum. This one you're now in is for VB for .Net

https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=isvvba


这篇关于Excel VBA:禁止“检查名称”发送邮件时的框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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