0

我正在尝试在某个工作表中引用另一个工作簿中的单元格 A1,以将其设置为电子邮件中的“收件人”字段。这是我的代码:

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

Addresses = Workbooks("Test.xlsx").Sheets("Sheet2").Range("A1").Value

On Error Resume Next
With OutMail

.to = Addresses
.CC = ""
.BCC = ""
.Subject = "Confirm " & Format(Date, "mm.dd.yy")
.body = "Please see attached for your confirm.  Thanks,"
.Attachments.add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

当我执行宏时,电子邮件中的“收件人”字段中没有任何内容。我引用的单元格肯定有它的价值。有没有人有什么建议?

4

1 回答 1

1

尝试移动display到开头。所以...

With OutMail

    .display
于 2013-07-31T20:43:16.970 回答