Tag: outlook

在Outlook中导入联系人/ Nab群组

在这种情况下,我必须导入组织中的所有联系人,包括nab组或联系人。 我有我find的代码,但不包括联系人组。 这只会导入联系人。 Sub Email_Extract() Dim colAL As Outlook.AddressLists Dim oAL As Outlook.AddressList Dim colAE As Outlook.AddressEntries Dim oAE As Outlook.AddressEntry Dim oExUser As Outlook.ExchangeUser Dim n As Long Set colAL = Outlook.Application.Session.AddressLists For Each oAL In colAL StartTime = Timer If oAL.AddressListType = olExchangeGlobalAddressList Then Set colAE = oAL.AddressEntries n = 2 For Each […]

如果存在特定的单元格值,则自动发送电子邮件; 在体内包含相邻的值

我一直在做一个xlsm表单,作为其函数的一部分,如果在其他数据文件中找不到匹配项,则在J列中产生“无数据”的结果。 我需要的是让Excel循环通过J列,并自动生成一个电子邮件,如果J =“无数据”的值,并在电子邮件的身体,我需要包括在同一行F列的单元格偏移值。 我已经使用了Ron De Bruin代码,并使用来自项目其他地方的类似function的循环代码对其进行了修改。 我不能得到这个function,可以使用一些方向。 这是我到目前为止的代码 Private Sub EmailIC() 'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm 'This macro adapted from: http://www.rondebruin.nl/win/s1/outlook/bmail4.htm Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wbXLoc As String, wbX As Workbook, wsX As Worksheet, wsXName As String Dim Xlr As Long Dim rngX As Range, cel As Range, order As Range […]

VBS:在Outlook中设置不在办公室答复与开始date和结束date

我正在通过阅读MS Excel工作表的脚本来自动化Outlook中的OOO。 该脚本从input电子表格中读取开始date和结束date,然后在Outlook中为这些date设置不在办公室的回复。 此脚本获取当前date,如果从电子表格中读取的开始date是明天的date,则会提示用户。 这个想法是提醒用户设置OOO,然后根据用户的确认自动设置。 例如,如果excel表格的开始date和结束date分别21-Oct-2016 24-Oct-2016并且如果此脚本在20-Oct-2016运行,则应该能够设置OOO启动21-Oct-2016年21-Oct-2016年21-Oct-2016 24-Oct-2016自动(无需打开MS Outlook) 到目前为止,我可以阅读电子表格并获取date。 但是,我不能在以后的时间里设定OOO。 以下是正在进行的代码: Sub ReadDataAndSetOOO() Dim objExcel,ObjWorkbook,objsheet intRow = 2 Dim startDateValue, endDateValue Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("C:\input.xlsx") set objsheet = objExcel.ActiveWorkbook.Worksheets(1) DateToday = FormatDateTime(Date, 1) DateTomorrow = formatDate(FormatDateTime(DateAdd("d", 1, DateToday), 1)) Wscript.Echo DateTomorrow Do Until objExcel.Cells(intRow,1).Value = "" startDateValue = formatDate(FormatDateTime(objsheet.Cells(intRow,1).value,1)) endDateValue […]

Outlook从文件添加引用

我在Outlook中创build了一个需要Word和Excel引用的macros。 它必须在不同版本的Office上工作(2007,2010,2013)。 我有Office 2013,所以当我在2007和2010“安装”macros(复制VBAProject.otm)时,我有遗漏的引用。 我想在Excel中使用与此类似的代码手动添加引用: ThisWorkbook.VBProject.References.AddFromFile 但是我找不到那样的东西 我search了互联网,但我也失败了。 任何人都可以告诉我,如果在Outlook VBA可以添加文件的引用?

将单元格范围复制到outlook邮件主题

这个代码的function是复制特定范围的单元格 ,每个单元格(像1ML-234-1R这样的代码 ), 并将其放在Outlook邮件主体 (取自Ron de Bruin Excel自动化代码)中。 我希望单元格数据进入用逗号(,)分隔的邮件主题 ,并且不会在任何单元格数据之前或之后留下任何空格 。 Sub Mail_Selection_Range_Outlook_Body() 'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm 'Don't forget to copy the function RangetoHTML in the module. 'Working in Excel 2000-2016 Dim rng As Range Dim OutApp As Object Dim OutMail As Object Set rng = Nothing On Error Resume Next 'Only the visible cells […]

如何使用vba从2个不同的用户获取默认的Outlook文件夹

有一个从Outlook与VBA获取默认文件夹的命令是: OutlookApplication.Session.GetDefaultFolder(x) 例如: OutlookApplication.Session.GetDefaultFolder(olFolderOutbox) 但是,电子邮件用户名并未在代码中声明,因此它将使用默认的Outlook用户。 我的问题是如何使用该function与两个用户,假设我有2个电子邮件链接到我的Outlook帐户。 希望得到一个满意的答案,在此先感谢。

转发电子邮件的代码很慢

我发送电子邮件到一个联系人的大名单。 我不想丢失原始邮件的格式。 我正在使用这个代码: Dim emailad, firstname, pretit, midtit, prebod, bod, postbod As String Dim n As Integer n = 1 pretit = Sheets(CurrSh).Range("pretit").Value midtit = Sheets(CurrSh).Range("midtit").Value prebod = Sheets(CurrSh).Range("prebod").Value bod = Sheets(CurrSh).Range("bod").Value postbod = Sheets(CurrSh).Range("postbod").Value Dim objMail(1 To 500) As Object Set objitem = GetCurrentItem() '********** Send e-mail for each e-mail in the list *********** […]

在VBA中发送Outlook电子邮件,任何冒号“:”的主题都会导致电子邮件空白

我有一个复制word文档内容的macros,将其粘贴到电子邮件中。 然后从Excel中提取电子邮件地址和姓名,并向每个人发送附件的电子邮件。 (本质上是一个邮件合并) 问题是,任何时候,主题有冒号“:”,电子邮件发送为空白。 这不会发生,如果我保存电子邮件,也不会显示它。 只有立即发送才会发生。 这里是代码: Option Explicit Sub SendInitialEmail() 'directory of email body Dim dirEmailBody As String ' Directory of email template dirEmailBody = _ "C:\Users\me\Documents\Email Body.docx" Dim wordApp As Word.Application Dim docEmail As Document ' Opens email template and copies it Set wordApp = New Word.Application Set docEmail = wordApp.Documents.Open(dirEmailBody) docEmail.Content.Copy Dim […]

使用Excel文本框中的文本发送Outlook电子邮件 – 错误424:需要对象

我正在尝试使用文本框中的文本(我在Excel中将其命名为tx)作为正文发送电子邮件。 当我运行代码时,线上有一个错误: strbody = tx.Text 错误424:需要的对象 Sub SendMail() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim strbody As String Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) strbody = tx.Text 'On Error Resume Next With OutMail .To = "…" .CC = "" .BCC = "" .Subject = Cells(3, 2) .Body = strbody .Send End […]

Loop vba同时显示各种电子邮件

我用WINRAR压缩一个10MB的文件。 我想循环并创build一个电子邮件附加每个部分,并显示所有的电子邮件发送之前。 Set OutApp = CreateObject("Outlook.Application") Application.Wait (Now + TimeValue("0:00:30")) On Error GoTo 0 Set OutMail = OutApp.CreateItem(0) For i = 1 To times With OutMail .To = wb1.Sheets("MAIL").Cells(4, 3).Value .CC = wb1.Sheets("MAIL").Cells(5, 3).Value .BCC = "" .Subject = wb1.Sheets("MAIL").Cells(6, 3).Value .Body = wb1.Sheets("MAIL").Cells(9, 3).Value 'You can add other files also like this If (times […]