outlook-vba

BCC in ItemSend event in Outlook 2007 no longer works

孤街浪徒 提交于 2019-12-29 08:42:05
问题 I inserted code in ItemSend and saved the ThisOutlookSession module. It worked once and no longer works. It was saved as VBAproject.OTM and is still there when I open the module after restarting Outlook. Private Sub Application_ItemSend(ByVal Item As Object, _ Cancel As Boolean) Dim objRecip As Recipient Dim strMsg As String Dim res As Integer Dim strBcc As String On Error Resume Next ''# #### USER OPTIONS #### ''# address for Bcc -- must be SMTP address or resolvable ''# to a name in the

Excel VBA @SQL String filter Multiple LIKE Condition

*爱你&永不变心* 提交于 2019-12-29 01:49:10
问题 This code works as intended but I also need to exclude Autoreplies and some other strings in a subject line. I need to know if it's possible to add 2 or 3 more Likes. I tried And and Or conditions but I'm getting a parse error. This code below works. I just need to add another string condition after undeliverable. " Like '%Automatic reply%'". Filter = "@SQL=" & " Not " & _ "urn:schemas:httpmail:subject" & "" & _ " Like '%undeliverable%'" thanks. 回答1: OR Should work, The following Example have

Add attachment with varying date in file name to Outlook mail

旧时模样 提交于 2019-12-28 19:26:47
问题 I have an Excel file named "Home Audio for Planning (28-3-2013). The date will change every day but the text will be the same. How do I attach those files to Outlook? Sub Test() Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) With OutMail .To = "" .CC = "" .BCC = "" .Subject = "This is the Subject line" .Body = "Hello World!" .Attachments.Add ("C:\Users\Desktop\Today\Home Audio for Planning (28-3-2013).xlsx")

Use an Outlook Macro to Send Files by Email

北城余情 提交于 2019-12-26 10:36:39
问题 Attaching all files of a folder to a Microsoft outlook email using a macro code Dim fldName As String Sub SendFilesbuEmail() ' From slipstick.me/njpnx Dim sFName As String i = 0 fldName = "C:\Users\" sFName = Dir(fldName) Do While Len(sFName) > 0 Call SendasAttachment(sFName) sFName = Dir i = i + 1 Debug.Print fName Loop MsgBox i & " files were sent" End Sub Function SendasAttachment(fName As String) Dim olApp As Outlook.Application Dim olMsg As Outlook.MailItem Dim olAtt As Outlook

Save outlook mail automatically to a specified folder

二次信任 提交于 2019-12-25 18:45:33
问题 I would like to automatically save emails every time I receive from a particular ID (ex- 'xyz@abc.com') into a specified folder. I can then use this file as a trigger for my script. Can this be done? Will this need VBA or just outlook? It would be great if the mail can be saved as a text file. 回答1: Set Macro security low in your Outlook: go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

Replace a string in a sent email

a 夏天 提交于 2019-12-25 14:46:41
问题 The following code creates and sends a simple email. After the email is sent it replaces a string in the email body. My code works when I use the debugger’s single-step feature to execute the code. It also works when I add a MsgBox instruction with a “click to continue” button after the objMsg.Send instruction. It does not work when I execute the macro without interruption, but tells me that Outlook cannot save an email to the folder when a macro is running. Sub CreateNewMessage() objMsg As

Change the From Field

非 Y 不嫁゛ 提交于 2019-12-25 14:00:29
问题 I have a single Outlook email set up on my Outlook account, let's say "example@xxx.com". I have another "email account", let's say "alias@zzz.net", that serves as nothing more than a pointer to my @xxx.com account. Outlook has no settings for the pointer account other than my ability to type it into the From field. I have Outlook set up to manually change the From field between @xxx.com and @zzz.net. Because my @xxx.com email is the actual email, Outlook defaults to that email in the From

Output to Excel from Outlook using VBA

我的未来我决定 提交于 2019-12-25 12:54:30
问题 I have a VBA script sitting in Outlook that attempts to grab information from email items and write it to an Excel file. I'm pretty new to VBA, so after much debugging and editing, I've managed to get something that mostly works, but I could use a little guidance. I'll explain my script and then talk about my problem. I've included my full script at the end. Here is a quick outline of it, where I include the parts that I think might need some work. Sub Output2Excel() Dim xlApp As Object Dim

Outlook vba cannot sent email as script assigned to rule

最后都变了- 提交于 2019-12-25 08:33:58
问题 I have to run a vba script as a rule in Outlook that 1. "Catch" specific mail with attachment(Excel) 2. save this attachment as a file and do some changes in this file 3. send by email this "changed" file. P.1 and P.2 I've already done, but I can't send and email. I try this simple code as a rule when I've got a message with specific words in subject run this script: Sub sendemail() Dim OutlApp As Object On Error Resume Next Set OutlApp = GetObject(, "Outlook.Application")<---use this

VBA outlook 2010 move

帅比萌擦擦* 提交于 2019-12-25 07:24:44
问题 m.display works but m.move(A) does not. The folder exist. Private Sub Application_NewMailEx(ByVal EntryIDCollection As String) Dim arr() As String Dim myInbox As Outlook.Folder Dim A As Outlook.Folder Set myNameSpace = Application.GetNamespace("MAPI") Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox) Set A = myInbox.Folders("A") Dim i As Integer Dim m As MailItem On Error Resume Next arr = Split(EntryIDCollection, ",") For i = 0 To UBound(arr) Set m = Application.Session.GetItemFromID