使用发送方法失败的Outlook发送邮件 [英] Sending mail using Outlook where the Send method fails
本文介绍了使用发送方法失败的Outlook发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码从Excel发送电子邮件:
I use this code to send email from Excel:
Sub Mail_workbook_Outlook_1()
'Working in Excel 2000-2013
'This example send the last saved version of the Activeworkbook
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send ' <--------------------------------This is causing troubble
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
问题是。发送
不被识别为对象(或方法)。
The problem is that .Send
is not recognized as an object (or method).
其他命令正在运行(即显示,保存)。
Other commands are working (i.e. Display, Save).
我认为此错误是由于我的安全系统而存在的。我什至尝试使用CDO,但它不能正常工作。
I believe this error exists because of security systems at my work. I have even tried using CDO and it is not working ether.
推荐答案
更改。发送
到 .Display
并将 SendKeys ^ {ENTER}
放在之前使用OutMail
行。
这篇关于使用发送方法失败的Outlook发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文