Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default excel macro to copy the outlook mail body to a new excel workbook

I have written the macro code in excel, and from excel macro iam able to
DISPLAY the mail based on subject provided, now i need a macro code to copy
the body of displayed mail and paste it to a new excel workbook.

Here is my code....

Private strForwardTo As String

Sub subject_beginswith()

Dim ns As Namespace
Dim Inbox As MAPIFolder
Dim myitem As Outlook.MailItem
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim objSearchFolder As Outlook.MAPIFolder
Dim Recipient As Outlook.Recipient
Dim CorrRecip As String
Dim item As Object
Dim Body

Dim mai As MailItem


Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set objSearchFolder = Inbox
i = 0

If Inbox.Items.Count = 0 Then
MsgBox "Inbox is Empty", vbInformation, "Nothing Found"
End If

For Each item In Inbox.Items
If Format(item.ReceivedTime, "DD/MM/YY") < Format(Date, "DD/MM/YY") Then
GoTo nextme
If item.Subject Like "Reminder to complete the 2008 Thomson Reuters
Employee*" Then
item.Display
' Workbooks.Add
'ActiveSheet.Paste
SendKeys "(^A)"

Exit Sub
End If
nextme:
Next

End Sub




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default excel macro to copy the outlook mail body to a new excel workbook



"Ranjit kurian" wrote:

I have written the macro code in excel, and from excel macro iam able to
DISPLAY the mail based on subject provided, now i need a macro code to copy
the body of displayed mail and paste it to a new excel workbook.

Here is my code....

Private strForwardTo As String

Sub subject_beginswith()

Dim ns As Namespace
Dim Inbox As MAPIFolder
Dim myitem As Outlook.MailItem
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim objSearchFolder As Outlook.MAPIFolder
Dim Recipient As Outlook.Recipient
Dim CorrRecip As String
Dim item As Object
Dim Body

Dim mai As MailItem


Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set objSearchFolder = Inbox
i = 0

If Inbox.Items.Count = 0 Then
MsgBox "Inbox is Empty", vbInformation, "Nothing Found"
End If

For Each item In Inbox.Items
If Format(item.ReceivedTime, "DD/MM/YY") < Format(Date, "DD/MM/YY") Then
GoTo nextme
If item.Subject Like "Lock*" Then
item.Display
' Workbooks.Add
'ActiveSheet.Paste
SendKeys "(^A)"

Exit Sub
End If
nextme:
Next

End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending a Mail from outlook with body coming from excel file PauloD Excel Discussion (Misc queries) 1 November 11th 10 01:59 PM
HELP!.. copy Bitmap of range from Excel to Outlook body WhytheQ Excel Programming 1 October 17th 07 11:53 AM
Excel(with hyperlinks) as a message body of outlook mail hans Excel Discussion (Misc queries) 1 July 7th 06 12:35 PM
Late Binding to Outlook from Excel: Outlook modifies email body Lenny Wintfeld Excel Programming 0 December 12th 04 04:03 PM
Excel Copy and Paste into Outlook e-mail Compuser Excel Programming 2 December 5th 04 10:11 AM


All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"