outlook-vba

How to save attachments and rename it

感情迁移 提交于 2020-01-16 02:52:47
问题 I am having an issue getting my code to work. This is my first time running a VBA script. I have a large amount of emails coming in from a fax machine and I want to be able to download the attachments, rename the file to the subject line and then store them on my computer. My first attempt, I tried to just write a macro so that I could manually do it but after doing some research, I was under the impression that I wanted to make rules work. This is my first attempt at VBA so I'm not even sure

How to read Custom Field value of outlook

纵饮孤独 提交于 2020-01-15 18:51:34
问题 Can anyone tell me how to read the custom Field value of the outlook using c# Right now i tried "UserProperties" and "ItemProperties". Both are throwing error. My sample code as follows Microsoft.Office.Interop.Outlook.Application f = new Microsoft.Office.Interop.Outlook.Application(); NameSpace outlookNS = f.GetNamespace("MAPI"); MAPIFolder inboxFolder = outlookNS.GetDefaultFolder(OlDefaultFolders.olFolderInbox); foreach (object obj in inboxFolder.Items) { MailItem item = obj as MailItem; if

Capture the event while moving the mail from subfolder to inbox

白昼怎懂夜的黑 提交于 2020-01-15 08:43:05
问题 I have the requirement to capture the event when the mail is moved from Subfolder to Inbox The folder structure is as below myarchive-mailbox name Inbox Main folder requests Sub folder myarchive Inbox requests When the email is moved from requests subfolder to Inbox, of myarchive mailbox Name ,this mailbox item should be captured and the event handler should be invoked. I have already implemented the code for capturing the event when the file is moved from myarchive inbox to requests.The code

Delete email from inbox and also delete it from deleted-items folder via rule->script

泄露秘密 提交于 2020-01-15 05:05:09
问题 I created a rule, that starts a VBA-script depending on the subject of a received email (Rule: Subject "MY_SUBJECT" -> start script). The VBA script is then doing some stuff and then it should finally delete the original email. This part is easy: Sub doWorkAndDeleteMail(Item As Outlook.MailItem) ' doSomething: ' delete email from inbox Item.Delete End Sub Now the email will sit in the deleted-items-folder. But what I need to achieve is, to also delete this mail from the deleted-items folder.

How to Search Items with Attachment and keyword in Subject using Filter

匆匆过客 提交于 2020-01-14 02:27:12
问题 I am working on a code which attachment will be download to folder location in context to subject by using a subject filter. After a long search on the internet, my code is working but the problem here is that I want to put the keyword in the subject filter so that it will download the attachment as the subject keep changing every day e.g. Sub: training_24357 on one day and training_24359 on the next day. Also, I want to run my code after every 5 minutes automatically, any help will be much

VBA Outlook Appointment

馋奶兔 提交于 2020-01-13 07:11:27
问题 I am trying to copy data from Excel to Outlook appointment Item. I have already created a template with a table and some images and would like the data to be copied from the excel file in the already formatted table in the body of the template. However, unlike e-mail, outlook appointment does not support ".htmlbody" property hence, its getting difficult to paste the data in the template. So far, I am trying to do this: Dim olAppItem as Outlook.AppointmentItem Set olAppItem = olApp

Select the content of Word document and paste it into the body of Outlook with VBA

爷,独闯天下 提交于 2020-01-13 06:38:08
问题 I have a Word template created and I need to do the following: Create a new document based on that template Modify some data of the new template and copy all its contents Open Outlook and paste the template into the body of the message Send the message to the corresponding recipient Note: The base template will be used for several recipients according to their data. Basically, it is almost the same function that the Word correspondence tab fulfills, only customized. In addition, the VBA code

Outlook 2007 Macro to read excel file containing file paths and create hyperlinks

◇◆丶佛笑我妖孽 提交于 2020-01-07 07:57:06
问题 I'm fairly new to VBA scripting and I'm trying to write a macro in Outlook that reads an excel file that has full paths and filenames in separate cells and inserts them as hyperlinks in an email. I've found information on how to create a hyperlink in Outlook but can't seem to find anything on how I would go about having Outlook actually getting the file paths from the Excel sheet. Any help or pointers in the right direction would be greatly appreciated. Thanks! Edited to include a simple

VBA - select the first file from a specific folder and reply all

半世苍凉 提交于 2020-01-07 05:05:08
问题 I saved multiple outlook msg on a specific folder named "email temp folder" and would to reply on the first msg in the folder. However there is an error: type mismatch occur in the below lines. Could you somebody help me on this please? Sub outlookActivate1() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim fso As New FileSystemObject Dim objFolder As Object Dim objFile As Object Dim FileItemToUse As Outlook.MailItem Dim i As Long Set OutApp = CreateObject("Outlook

VBA to save attachments (based on defined criteria) from an email with multiple accounts

梦想的初衷 提交于 2020-01-07 04:35:09
问题 Situation: I have a code that, given an input of sender email, will download all attachments from outlook email (if the sender is the one specified, it saves the .xls attachments). Problem 1: In my outlook, I have access to 2 accounts (lets say personal and public). I want to be able to select from which of those accounts the code should download the attachments. Question 1: Is it possible to do this kind of selection? From previous research I was able to find criteria regarding the type of