|
1、是附件加不上,2是警示框提示,我公司outlook信任中心那里是灰色的,没办法,求高手修正。
发邮件.zip
(46.55 KB, 下载次数: 1)
Dim myfilename, a, b, addf As String, n As Integer
myfilename = "D:\日报邮件文件夹\日报邮件.xlsm"
Workbooks.Open Filename:=myfilename
Range("e6") = " D:\日报邮件文件夹\日报邮件.xlsm"
addf = Range("e6").Value
finalrow = ActiveSheet.Cells.SpecialCells(xlLastCell).Row
On Error Resume Next
Dim endRowNo
Dim objoutlook, objmail As Object
Set objoutlook = CreateObject("outlook.application")
Set objmail = objmail.CreateItem(0)
For n = 5 To finalrow
Workbooks("发邮件.xlsm").Activate
Sheets("邮件地址").Select
Set objmail = objoutlook.CreateItem(olMailItem)
With objmail
.To = Cells(n, 3).Value
.from = "yanha@ss-express.com"
.Subject = Cells(n, 2).Value & "收到请删除,试试程序发邮件呢"
.body = Cells(n, 4).Value
.Attachments.add addf
.Display
.DoEvents
.SendKeys "%s", True
.Send
End With
Set objmail = Nothing
Next
Set objoutlook = Nothing
End Sub
|
|