I am looking for some code to pull values from the body of an outlook message. I will set up the whole situation I need below:
An email is sent with specific subject and certain values in body.
-Subject could be "Test"
-In body of email it would be:
Name: (name here changes)
Number: (number here changes)
I can set up the Excel file I need to open after this email is received, but what I need is for that Excel file that opens, to look back at that email message and pull the name and number (that can change) into cells A1 and B1.
Keep in mind that there will be multiple emails coming through with this same format, so it should only look in message that was just sent a minute or two ago.
Is this possible? Any help would be greatly appreciated. Thanks.
Since the triggering action is the receipt of an email, I would suggest that you focus on having Outlook running the script when the message is received and then pushing the information to the Excel sheet. Here is something that will get you started.
You will want to make sure that there is a way to easily identify where the name field is on the email body too, possibly wrapping it like [[NAME]] Person Name Here.
Related
I'm trying to learn how to use Excel/VBA to automate as much of the below workflow as I can:
I receive an email from a manager notifying me that an employee has Covid. This initial notification is not standardized
I manually enter the information (employee name, their state, company, test date, test results, etc) into a spreadsheet. Sometimes certain cells information are left blank if they are not provided in #1
I REPLY ALL to original email. I use a template and edit based on the information I've entered into the spreadsheet (for instance, certain states have different guidelines) and attach PDFs depending on the company. I may also ask for missing information
My goal is to:
Be able to press a button in excel to draft an email body with information I've entered into spreadsheet. A combination of "mad lib" and "if this then that". If specific cells are blank, Id want the email to include what information i still need. I only send this specific email once, but I have to do it again every time there is a new Covid case.
My restrictions are:
Multiple people use this same workflow and spreadsheet, so ideally it would be simple for coworkers. I do not want excel to automatically send the email without the user reviewing it first.
I am very new to VBA, but am learning Python.
I cannot download anything on my work computer.
Thank you so much!
In my data set, I have a column with a large number of email addresses, some repeating, some not.
I have inserted a new column to the right where I've copied the same list and removed duplicates.
I want to be able to use the list of removed duplicates to loop through the full column of emails and grab the data in the rows for each repetition of that email and paste that data into an email body send the email to that contact. Then, when there are no more repetitions of the first email in the list, it moves on to the next email in the list and does the same for each until it's gone through the complete list.
Is this something that's possible? My VBA experience is limited, so any help would be greatly appreciated.
Thank you in advance!
This is very doable in VBA. The best bet would be to either create an Access Database with a table that documents every time you send an e-mail to a certain e-mail address. That way you can check that list before generating another e-mail. It would work like this-> 1. Check to see if the e-mail is in the table. 2. If it is, then go to the next e-mail. 3. If it isn't insert the email into your table and send an e-mail. You could do this with a spreadsheet too, but I would prefer to use a table for this kind of thing. This table could be expanded upon to make a log as to when and what you sent to each user.
I'm trying to find an easy way to disseminate an excel template to a group of people and them input some data and then email the updated template back to me.
One alternative that I've investigated is sending the excel template as the body of an outlook email and then have the users make there input and email it back.
I came across this article that explains how to email a workbook as the body of an outlook email. The process works great, however, it appears the emailed spreadsheet can not be edited by the recipient.
Question:
**Is it possible to not only email the workbook/template as a body of an outlook email, but also make the template editable so the recipient can input data into select cells.
Unfortunately you cannot make edits and forward the changes when working in the message body (or with a file previewer).
An alternative is to open the email with the attachment and put the email into Edit mode. You can then open the attachment, make changes and save, then save the email and forward it.
I've been sending Outlook emails from Excel for a while, using it to manage my sales and project management activities at work. I've been enjoying increased productivity from it, so I want to do some more advanced things. For example, I think I have the code worked out, probably in a crude way, to have Excel help keep track of emails that have not been replied to. (I simply have Outlook, for each new email, open a workbook, and create a record in a new row, then have Excel attempt to match it to an email I previously sent.)
But once I have a record in Excel of such an email, it has no link or connection to the actual email. I want to be able to click on the Excel icon or link for the email, and then pull up the actual email.
I have found possibilities in using EntryIDs and MessageIDs, Outlook URLs and GUIDs,and even good-old AdvancedSearch (but I think having Excel search for an email that it initiated seems pretty clunky; there should be a way to create a hard link to the email).
Relatedly, and also probably just as clunky, but I've pondered "embedding" a unique identifier in each Excel-initiated email, that could be used to find it and link it back to a record in Excel. In an HTML email, I can add a string of numbers under my signature, in white text on a white background, and it's not perfect but in most cases should go unnoticed, and would allow my spreadsheet to positively identify it (as a reply to a particular email, etc.)
I know we're not supposed to ask for "advice" but I am hoping someone can point me in the right direction to something that may work for what I hope to accomplish.
Why not use the email's time sent (TIMESTAMP - MMDDYYYYHHSS), Recipient, and Subject Line as unique, identifying markers? Add these fields to your row data. Then, after email is sent, create a macro event that will:
Launch the Outlook App
Open the Sent Folder
Loop through all items
Filter email to the markers (Time, Recipient, Subject Line) of the active Excel row
Open the Email Item
Aside, my personal advice is to use a database like MS Access which works great with its siblings, Excel and Outlook. Also, it is designed to maintain relationships between data elements. Access could hold all the needed email content (emailID, recipient, subject, body, date, emailsent?) and with forms can provide AfterUpdate, ButtonClick, OnOpen events to manage the process of data entry, email process, data update, so on. If only you knew the increased productivity that comes with a relational database!
You can add a user property to the MailItem class. See the UserProperties collection for more information.
The automated systems add an ID to the end if the Subject line.
I have got an excel sheet with many email ids (duplicates also).Need a macro which can pick distinct email ids from the list and send email to all of them in a single mail.Also the mail subject must contain date e.g Release X report dated DD-MMM.Mail body should copy a range of cells from the same excel sheet.Can someone please help me with the macro.
Provided you have the outlook client installed - take a look at this http://www.rondebruin.nl/win/s1/outlook/bmail2.htm. It looks like a nearly right out of the box answer, even though you still need to get into it a little bit and adjust mail parameters to your case
This code basically involves 2 main parts:
- the main Mail_Selection_Range_Outlook_Body procedure, which sets an instance of the outlook application, creates an email, populates parameters (to, cc, subject, body...) and sends the email
- the RangetoHTML utility function called by the main procedure, which publishes the excel data range to be sent to HTML. The result is assigned to the mail item HTMLBody - not Body - property in the main procedure for proper rendering
You should select your source data range before running the main procedure.
For test purposes, you may find it helpfull to replace the ".send" mail item property with ".display" in a first place - this will result in the main sub displaying the ready to be sent mail on screen rather than actually just sending it.