我有以下代码,在这个之前的 10 个宏可以正常工作(我使用调用 x,调用 Y 宏),但是这个不想工作。
Sub Send_Tips()
Application.DisplayAlerts = False
Dim Email_Subject, Email_Send_From, Email_Body As String, i As Integer
Dim Mail_Object, nameList As String, o As Variant
Email_Send_From = ""
For i = 1 To 1 'use cells 1 to 1 in column "A" where names are stored
If Sheets("Tips").Range("A1").Value <> "" Then
nameList = nameList & ";" & Sheets("Tips").Range("A" & i).Value
End If
Next
Set Mail_Object = CreateObject("Outlook.Application")
With Mail_Object.CreateItem(o)
.Subject = "Dealer Action Plans"
.To = nameList
.Body = "Please find attached the latest version of the Dealer Action Plans."
'Make a copy of the active sheet and save it to
'a temporary file
Worksheets("Tips").Activate
ActiveSheet.Copy
Set wb = ActiveWorkbook
Filename = "Tips.pdf"
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Worksheets("Tips").ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="c:\aaaWork\Tips.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
' ActiveWorkbook.SaveAs Filename:="C:\aaaWork\NC1.PDF", FileFormat:=17
.Attachments.Add "C:\aaaWork\Tips.PDF"
.send 'Will send straight away use .display to send manually
ActiveWorkbook.Close Saved = True
Kill "C:\aaaWork\Tips.PDF"
End With
Application.DisplayAlerts = True
End Sub
当运行 .send '将立即发送使用 .display 手动发送行时,我收到以下错误消息。运行时错误“2147467259 (80004005)”:Outlook 无法识别一个或多个名称
工作表名称提示确实存在,有什么想法吗?
谢谢!