VBA运行时错误1004 - 发送电子邮件的宏

时间:2017-06-13 15:28:35

标签: vba

我有一个宏发送以前正常工作的电子邮件,现在它给出了运行时错误1004,我不知道为什么(我删除了真正的电子邮件地址):

子邮件()

Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False

Application.DisplayAlerts = False
Dim aws As String
Dim olapp As Object
ActiveWorkbook.ActiveSheet.Copy
strfilename = "\\ant\dept-eu\muc-cat-users\books\product_mgt\4_promotion\PR\Hoerzu\Top5Hoerzu" & "_" & Format(Now, "yy-mm-dd") & ".xlsx"


ActiveWorkbook.SaveAs strfilename
aws = ActiveWorkbook.FullName
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = "xxx@xxx.de"
.cc = "xxx@xxx.de" & ";" & "xxx@xxx.de" & ";" & "xxx@xxx.de"
.bcc = "xxx@xxx.de" & ";" & "xxx@xxx.de"
.htmlbody = "<p>Hallo zusammen,</p><p>im Anhang findet Ihr die xxx Charts der vergangenen Woche für die Hörzu.</p><p>Viele Grüße</p>xxx"

.Subject = "Charts Hörzu"

.Attachments.Add aws
.display

End With
Set olapp = Nothing
Application.DisplayAlerts = True

End Sub

谢谢!

0 个答案:

没有答案