+ Reply to Thread
Results 1 to 4 of 4

Importing emails and subject line

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Importing emails and subject line

    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.

  2. #2
    Forum Contributor
    Join Date
    01-17-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    211

    Re: Importing emails and subject line

    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.

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Re: Importing emails and subject line

    I want from outlook to update in an existing excel file.

  4. #4
    Forum Contributor
    Join Date
    01-17-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    211

    Re: Importing emails and subject line

    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VB Code to copy subject line and emails
    By sathishkm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2013, 01:59 PM
  2. Opening emails based on subject
    By MikeFranz123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2013, 02:15 AM
  3. Outlook - prevent sending of emails without a subject matter
    By ErnieLaboy in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 01-04-2013, 12:40 PM
  4. Extracting data from all emails with a specific subject
    By kefalo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-29-2010, 06:14 PM
  5. [SOLVED] Save emails using only part of subject line
    By ir26121973 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-03-2006, 02:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1