Consulting

Results 1 to 3 of 3

Thread: Solved: Date & Time in he body of the message of received email

  1. #1

    Solved: Date & Time in he body of the message of received email

    Hi,
    I send some email with the table to the managers, requesting them to fill up the table and send back the email. When they reply to the email I can see their email address, date at the header.
    what i need is the complete details should be appeared in the body of the message after the table. so that I copy the data with the details.
    Eg.

    From: Nandhini Sathiya [mailto:nasathiy@in.ibm.com]
    Sent: Tuesday, July 15, 2008 3:21 PM
    Subject: Fw: TV Spoils Friendship...Too Cute...

    I will get the above data when i click forward to that email and copy the data. But If I have 100 emails i need to click forward or reply to copy the above data. Is there any way that wen i receive the email the above data come in the body of the message

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Not sure what you exactly want, but this will use excel to copy relevant info from the mailmessage.
    [VBA]Sub copy_mail_message_with_header()
    '*** Assuming you are using textformat and not html format
    ' for mail messages
    'use excel as destination
    Dim myexcel As Object
    'workbook
    Dim mywb As Object
    'worksheet
    Dim myws As Object
    'outlookmessage to be processed
    Dim mymessage As Outlook.MailItem
    'a number
    Dim myitem As Long
    'the message we create
    Dim mystrmessage As String
    'if selection isn't present, don't do a thing
    'you could build an extra check if the class
    'of the selected item is a message
    If ActiveExplorer.Selection.Count < 1 Then
    MsgBox "Select at least one mailmessage", vbInformation
    Exit Sub
    End If
    'define the application to use
    Set myexcel = CreateObject("Excel.Application")
    'property to true, you could do this after
    'everything has been done
    myexcel.Visible = True
    'add a new workbook
    Set mywb = myexcel.workbooks.Add
    'loop through the selected items
    For myitem = 1 To ActiveExplorer.Selection.Count
    'build the string
    Set mymessage = ActiveExplorer.Selection.item(myitem)
    mystrmessage = "From : " & mymessage.SenderEmailAddress & Chr(13)
    mystrmessage = mystrmessage & "Sent : " & mymessage.SentOn & Chr(13)
    mystrmessage = mystrmessage & "Subject : " & mymessage.Subject & Chr(13)
    mystrmessage = mystrmessage & mymessage.Body
    'if number of worksheets is less than no of items
    'use the present worksheets of the newly created
    'workbook
    If mywb.worksheets.Count < myitem Then
    Set myws = mywb.worksheets.Add
    myws.Name = myitem
    Else
    'otherwise rename the default name of sheetx
    'to just the number
    Set myws = mywb.worksheets(myitem)
    myws.Name = myitem
    End If
    'paste the created string at A1
    myws.Range("A1").Value = mystrmessage
    'go to next selected item
    Next myitem
    End Sub[/VBA]Charlize

  3. #3

    Thanks..but need some more help

    Hi,

    Thanks for your reply,
    What i need exactly is..

    I am sending an email with a table in the body of the message to one person requesting him to fill up some data and send me back.

    He will reply to the same duly filled. I will copy the table and paste it to an pdf image for record. But I have only the table in the body of the message and no Sender details. As of now what i am doing is, I copy and paste the table separately and again i click forward to that email, so that I get details as below

    From: Nandhini Sathiya [mailto:sathiy@in.ibm.com]
    Sent: Tuesday, July 15, 2008 3:21 PM
    Subject: Fw: TV Spoils Friendship...Too Cute...

    then i copy and paste again.


    What I need is, From email address, Date received & subject, should be appreard below the table so that I can copy that along with the table and paste.

    Is there any way that the above details comes automatically in the body of the message so that I can copy all the details.
    or is there any other way of working...

Posting Permissions

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