I want to read email from outlook in excel macro i want to add some filter for fetching email like subject from date etc.
Loading
I want to read email from outlook in excel macro i want to add some filter for fetching email like subject from date etc.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Naimish MakwanaPosted Apr 16, 2024, 4:20 AM
Sure, you can use VBA (Visual Basic for Applications) in Excel to interact with Outlook. Here’s a basic example of how you might set up a macro to read emails from Outlook, with filters on the subject and date.
Please replace
"Your Subject"and"Your Date"with your actual filter criteria.This script will loop through all emails in your Inbox and if the email’s received time is greater than or equal to your specified date and the subject matches your specified subject, it will write the subject, received time, sender’s name, and body of the email to the Excel sheet.
Please note that you need to enable the Microsoft Outlook Object Library in Tools -> References in the VBA editor.
Remember to replace
"Your Date"and"Your Subject"with your actual filter criteria. The date should be in the formatmm/dd/yyyy.This is a basic example and might need to be adjusted based on your specific needs and environment.
Thanks