Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello!
I have successfuly done, with your help, a macro that sends e-mail from excel, via outlook (very cool stuff by the way). I have a new task now. I want to import the text, subject and sender of an e-mail received in outlook to a data base I keep in Excel. Does someone know how to do this? Best regards and thanks in advance, Albert C |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jul 25, 11:06 pm, Albert wrote:
Hello! I have successfuly done, with your help, a macro that sends e-mail from excel, via outlook (very cool stuff by the way). I have a new task now. I want to import the text, subject and sender of an e-mail received in outlook to a data base I keep in Excel. Does someone know how to do this? Best regards and thanks in advance, Albert C I assume you're been to Ron de Bruin's site, which is where I got most of what's below. This code will get email from a specified folder and move the email to the Deleted Items once processed. Remove that section if you don't want it, but this will check every email in the folder and create duplicates if you're adding to a folder. You could add a check on date or something too so that it only works on email from a specified period. Sub GetFromInbox() Dim strEmployeeEmail As String Dim strArrivalTime As String Dim strSubject As String Dim strBody As String 'late binding to Outlook Dim olApp As Object Set olApp = CreateObject("Outlook.Application") Dim olNs As Namespace Dim Fldr As MAPIFolder Dim DelFldr As MAPIFolder Dim olMail As Variant Set olNs = olApp.GetNamespace("MAPI") Set Fldr = olNs.GetDefaultFolder(olFolderInbox) Set Fldr = olNs.Folders("mailbox - Your MB name").Folders("email test") Set DelFldr = olNs.Folders("mailbox - Your MB Name").Folders("Deleted items") For Each olMail In Fldr.items 'get the values needed from the email ArrivalTime = olMail.ReceivedTime EmployeeEmail = olMail.SenderName strBody = olMail.Body strSubject = olMail.Subject '---------------- 'Add Code Here to place the variables where you want them in your WB '------------------- 'move the email to Deleted Items olMail.Move DelFldr Next olMail Set Fldr = Nothing Set olNs = Nothing Set olApp = Nothing End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you much sir... Just what I needed.
" wrote: On Jul 25, 11:06 pm, Albert wrote: Hello! I have successfuly done, with your help, a macro that sends e-mail from excel, via outlook (very cool stuff by the way). I have a new task now. I want to import the text, subject and sender of an e-mail received in outlook to a data base I keep in Excel. Does someone know how to do this? Best regards and thanks in advance, Albert C I assume you're been to Ron de Bruin's site, which is where I got most of what's below. This code will get email from a specified folder and move the email to the Deleted Items once processed. Remove that section if you don't want it, but this will check every email in the folder and create duplicates if you're adding to a folder. You could add a check on date or something too so that it only works on email from a specified period. Sub GetFromInbox() Dim strEmployeeEmail As String Dim strArrivalTime As String Dim strSubject As String Dim strBody As String 'late binding to Outlook Dim olApp As Object Set olApp = CreateObject("Outlook.Application") Dim olNs As Namespace Dim Fldr As MAPIFolder Dim DelFldr As MAPIFolder Dim olMail As Variant Set olNs = olApp.GetNamespace("MAPI") Set Fldr = olNs.GetDefaultFolder(olFolderInbox) Set Fldr = olNs.Folders("mailbox - Your MB name").Folders("email test") Set DelFldr = olNs.Folders("mailbox - Your MB Name").Folders("Deleted items") For Each olMail In Fldr.items 'get the values needed from the email ArrivalTime = olMail.ReceivedTime EmployeeEmail = olMail.SenderName strBody = olMail.Body strSubject = olMail.Subject '---------------- 'Add Code Here to place the variables where you want them in your WB '------------------- 'move the email to Deleted Items olMail.Move DelFldr Next olMail Set Fldr = Nothing Set olNs = Nothing Set olApp = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
send email to each customer email in excel sheet. | Excel Discussion (Misc queries) | |||
reading email | Excel Discussion (Misc queries) | |||
Email addresses in Excel need to format for mass email | Excel Worksheet Functions | |||
Email editor closes when forwarding Excel-embedded email | Setting up and Configuration of Excel | |||
working on excel document in email saved changes in email not in . | Excel Discussion (Misc queries) |