Excel中的硬代码电子邮件地址

以下是使用任何电子邮件程序打开的简单代码。 我的问题是,我想添加三个电子邮件列表,但只有我有一个地址,Outlook 2013才能识别它。 前景的正确格式是什么? Application.Dialogs(xlDialogSendMail).Show _ arg1:="attributes@hotmail.ca", _ arg2:="East attributes" & Now()

我努力了

Application.Dialogs(xlDialogSendMail).Show _ arg1:="attributes@hotmail.ca" & ";" & "runaway@gmail.com", _ arg2:="East attributes" & Now()

您可以从Excel中自动执行Outlook以完成工作。 有关更多信息,请参阅如何从其他程序自动执行Outlook 。

使用“ 收件人”collections集来指定“收件人”,“抄送”或“密件抄送”收件人。

这是如何从Excel自动化Outlook的一个非常基本的例子。 请注意我正在使用LateBinding。

 Option Explicit Sub Sample() Dim OutApp As Object Dim OutMail As Object Dim MyFileList(1) As String Dim i As Long '~~> Change/Add the file names here MyFileList(0) = "C:\Sample1.xlsx" MyFileList(1) = "C:\Sample2.xlsx" '~~> Create a new instance of outlook Set OutApp = CreateObject("Outlook.Application") '~~> Create a new Email Set OutMail = OutApp.CreateItem(0) '~~> Set the To/CC/BCC etc here With OutMail .To = "MyEmail1@123.com" & ";" & "MyEmail2@123.com" & ";" & "MyEmail3@123.com" .CC = "MyEmail4@123.com" .Bcc = "MyEmail5@123.com" .Subject = "Example for attaching 2 files" .Body = "Hi Russel :)" '~~> Attaching file For i = LBound(MyFileList) To UBound(MyFileList) .Attachments.Add MyFileList(i) Next i '~~> Display the email. To send the email, Change the below to .Send .Display End With End Sub 

ScreenShot

在这里输入图像说明