Hi All,
I want to import email and the subject line from outlook to excel. Is there any macro or vb code to do so.
Hi All,
I want to import email and the subject line from outlook to excel. Is there any macro or vb code to do so.
you want to run it from outlook and udpate an existing excel file with the info from outlook ?
or
you have an excel file that is going to lookup the email in outlook to get the info ?
If solved remember to mark Thread as solved , to mark your thread as Solved select Thread Tools and click Mark thread as Solved.
I can't read the mind of my wife so then I get picture but no sound .... and then I mostly get the idea, same goes here picture your outcome and I get the idea.
I want from outlook to update in an existing excel file.
This should get you on the way
place it in a fresh module in your Outlook VBA session
then select an email and then run the sub GetSelectedItem (added)
![]()
Private Sub GetSelectedItem() Dim oApp As New Outlook.Application Dim oExp As Outlook.Explorer Dim oSel As Outlook.Selection Dim oItem As Object Set oExp = oApp.ActiveExplorer Set oSel = oExp.Selection For i = 1 To oSel.Count Set oItem = oSel.Item(i) DisplayInfo oItem Next i End Sub Sub DisplayInfo(oItem As Object) Dim oMailItem As Outlook.MailItem Set oMailItem = oItem Set excApp = CreateObject("Excel.Application") Dim strSheet As String strSheet = "c:\your file location here\...xls" '''''''''''''update location''''''''''''''' excApp.Workbooks.Open (strSheet) Set excWkb = excApp.ActiveWorkbook Set excWks = excWkb.ActiveSheet excApp.Visible = True excWks.Activate With excWks .Cells(1, 1) = oMailItem.Subject .Cells(1, 3) = oMailItem.ReceivedTime .Cells(1, 4) = oMailItem.Body End With End Sub
Last edited by hulpeloos; 10-21-2013 at 09:23 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks