outlook-vba

Macro to delete an email

被刻印的时光 ゝ 提交于 2019-12-11 01:58:19
问题 I have created a macro that forwards an email on to a recipient once a button is clicked. However, I want the macro to also delete the email (sending it to the recycle bin). Here is the current code. This currently works and forwards the email. Sub forwardEmail() Dim oExplorer As Outlook.Explorer Dim oMail As Outlook.MailItem Dim oOldMail As Outlook.MailItem Set oExplorer = Application.ActiveExplorer If oExplorer.Selection.Item(1).Class = olMail Then Set oOldMail = oExplorer.Selection.Item(1)

How to Capture Appt_Write Event in VBA when Appointment Object is Clicked and Dragged at the Same Time

风格不统一 提交于 2019-12-11 01:30:12
问题 I am trying to capture the appt_Write event on calendar appointment objects. The code below works well for every case EXCEPT when a user selects the appointment and drags it in one click. Is there a better way to set the appt object so that I can capture the appt_Write event for any appointment on any calendar? Private WithEvents objExplorer As Outlook.Explorer Private WithEvents appt As Outlook.AppointmentItem Public Sub Application_Startup() Set objExplorer = Application.ActiveExplorer End

Categorisation of incoming by Regex arouse : Application_NewMail : Byte Val Mismatch

☆樱花仙子☆ 提交于 2019-12-11 01:27:56
问题 I am working for the VBA Macros of Outlook 2010 to filter and categorize incoming emails into different folders. The rule is mentioned in the target When it comes to the implementation and testing, it does prompting error messages boxes instead of successful filtering. Would you please tell me what section under default call Application_NewMail shall proceed ? Target : extract words within [this Bracket] Subject : [ABC] --> create inbox folder ABC Subject : [CMX] --> create inbox folder ABC

Restrict method filter with multiple date condition

本秂侑毒 提交于 2019-12-11 01:09:51
问题 I'm trying to use Excel VBA to filter out my outlook mail inbox and then eventually send email if condition meets. The full condition is: If the Outlook Inbox contains Subject within the date range(past 7 days) and from Sender(dynamic sender email). I had completed the sub sendEmails() , now struggling with filtering mails. The code I have now successfully filter out the subject I'm looking at. However, after trying to include in the date range into the filter, It screwd up. First Problem:

Creating VBA macro to save email copy

六月ゝ 毕业季﹏ 提交于 2019-12-11 01:05:01
问题 I use Outlook (MS Exchange) and have an individual as well as two group inboxes ( I'm working logged in with the individual profile through which I also have access to the group inboxes ). When I send an email, I chose either my individual or one of the two group email addresses in the From field. When the email is sent, I want a copy saved in the inbox of myIndividualMailbox , groupAMailbox , or groupBMailbox depending on which From email address I used. Example: If I send an email From

Save Email Attachments to a Network location

懵懂的女人 提交于 2019-12-11 01:03:32
问题 I’m trying to create a VBA macro that saves an email attachment to folder depending on the email address. For example if I receive and email with an attachment from joey@me.com I want to save that attachment to the directory \server\home\joey or if I receive it from steve@me.com the attachment should be saved in \server\home\steve . And finally I want send a reply email with the name of the file that has been saved. I found some code that almost does what I want but I having a difficult time

Saving an item in the drafts folder also creates a blank outbox item

岁酱吖の 提交于 2019-12-11 01:00:58
问题 I have a C# console app that dynamically creates a bunch of emails and saves them to the Drafts folder in Outlook 2013. However, I've run into an issue where the items I create are not only created in the Drafts folder, but a blank item is also created in the Outbox folder (one blank Outbox item is created for every filled in Drafts item). For comparison, when I try to create a draft email using the UI, it works as intended. I create a new email, click Save, and the item only appears in the

In Outlook VBA, how can I change the subject so it changes the subject in the Explorer Pane?

蓝咒 提交于 2019-12-11 00:25:43
问题 When I receive an email, I'm manipulating the subject line so it is more readable and "conversations" generated by a certain auto-emailer actually contain all of the thread. I'm able to change the subject in the email view pane, but the subject remains the same in the explorer pane. How can I force the subject to change in the Explorer Pane? Do I have to copy the email and delete the old one? If so, I know that the email date will change. How can I change the email date back to the original

How can I extract attachments from Outlook, save as subject line and remove invalid characters?

佐手、 提交于 2019-12-11 00:19:34
问题 I am working on a project that requires me to save large numbers of attachments to a folder and filter them. I can currently save the attachments with the subject of the email as the filename. If there is more than 1 attachment then it saves as the subject line with a (1) or (2) and so on. I currently have a script that will do most of what I need (Thanks to the help from 0m3r in the replys below) The last thing I need to complete this script is something that will omit special caracters from

How to automatically run a macro on opening a draft in Outlook? (add a BCC)

大城市里の小女人 提交于 2019-12-11 00:15:52
问题 I'm trying to automatically achieve this workflow: when user opens a message draft in Outlook (a generated EML file) if the subject matches a string (immutable, known beforehand, I can't change it; it's something like xyžřy , note the non-ASCII characters): then add an e-mail to BCC field (immutable, known beforehand, valid e-mail address; let's say it's baz@example.com ) I already know the last part - how to add a BCC to a message, and I use InStr for matching: Sub addbcc() Dim objRecip As