Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA API for Outlook and Email managment

Hello,

I'm working on a VBA application to log email correspondances in a
spreadsheet. I would like to be able to export email conversations
along with dates, and other ppl involved in the conversation in a
spreadsheet. Anytime an email is sent to or from select address
Outlook will update this spreadsheet.

What is the best way to go about this? Is this possible and what
API's, libraries etc should I look at.


Any help would be greatly appreciated. I think this could be a very
useful Macro for anybody working in an Admin.

Thank you,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default VBA API for Outlook and Email managment

duadinam laid this down on his screen :
Hello,

I'm working on a VBA application to log email correspondances in a
spreadsheet. I would like to be able to export email conversations
along with dates, and other ppl involved in the conversation in a
spreadsheet. Anytime an email is sent to or from select address
Outlook will update this spreadsheet.

What is the best way to go about this? Is this possible and what
API's, libraries etc should I look at.


Any help would be greatly appreciated. I think this could be a very
useful Macro for anybody working in an Admin.

Thank you,


I'd ask this in an Outlook group since it's Outlook that will be
writing the workbook.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default VBA API for Outlook and Email managment

duadinam explained :
Hello,

I'm working on a VBA application to log email correspondances in a
spreadsheet. I would like to be able to export email conversations
along with dates, and other ppl involved in the conversation in a
spreadsheet. Anytime an email is sent to or from select address
Outlook will update this spreadsheet.

What is the best way to go about this? Is this possible and what
API's, libraries etc should I look at.


Any help would be greatly appreciated. I think this could be a very
useful Macro for anybody working in an Admin.

Thank you,


From Outlook, these work with Office 2010/64bit on Win7/64bit:

======================================
Public Sub MailSent_ExportToExcel()
Dim xlWorkbook As Excel.Workbook
Dim xlTargetRange As Excel.Range, Mail As Outlook.folder
Dim xlFileName As String, i As Object, j As Long, k As Integer

xlFileName = "D:\BC\Book1.xlsm"
Set xlWorkbook = Workbooks.Open(xlFileName)
Set xlTargetRange = [Sheet11!A30]

Set Mail = Session.GetDefaultFolder(olFolderSentMail)

For Each i In Mail.Items
j = j + 1
xlTargetRange(j, 1) = i.To
xlTargetRange(j, 2) = i.Subject
xlTargetRange(j, 3) = i.Body
xlTargetRange(j, 4) = i.SentOn
xlTargetRange(j, 5) = i.SenderName
For k = 1 To i.Attachments.Count
xlTargetRange(j, 5 + k) = i.Attachments(k)
Next
Next
xlWorkbook.Close (True)

End Sub
======================================


======================================
Public Sub MailReceived_ExportToExcel()
Dim xlWorkbook As Excel.Workbook
Dim xlTargetRange As Excel.Range, MailReceived As Outlook.folder
Dim xlFileName As String, i As Object, j As Long, k As Integer

xlFileName = "D:\BC\Book1.xlsm"
Set xlWorkbook = Workbooks.Open(xlFileName)
Set xlTargetRange = [Sheet11!A30]

Set MailReceived = ("Inbox ")

j = 1
xlTargetRange(j, 1) = "To"
xlTargetRange(j, 2) = "Subject"
xlTargetRange(j, 3) = "SentOn"
xlTargetRange(j, 4) = "SenderName"
xlTargetRange(j, 5) = "SenderEmailAddress"
xlTargetRange(j, 6) = "Body"

For Each i In MailReceived.Items
j = j + 1
xlTargetRange(j, 1) = i.To
xlTargetRange(j, 2) = i.Subject
xlTargetRange(j, 3) = i.SentOn
xlTargetRange(j, 4) = i.SenderName
xlTargetRange(j, 5) = i.SenderEmailAddress
'xlTargetRange(j, 6) = i.Body
For k = 1 To i.Attachments.Count
xlTargetRange(1, 6 + k) = "Attach-" & k
xlTargetRange(j, 6 + k) = i.Attachments(k)
Next
Next
xlWorkbook.Close (True)

End Sub
========================================

Bruno


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA API for Outlook and Email managment

On Oct 8, 8:02*am, Bruno Campanini wrote:
duadinam explained :









Hello,


I'm working on a VBA application to log email correspondances in a
spreadsheet. *I would like to be able to export email conversations
along with dates, and other ppl involved in the conversation in a
spreadsheet. *Anytime an email is sent to or from select address
Outlook will update this spreadsheet.


What is the best way to go about this? *Is this possible and what
API's, libraries etc should I look at.


Any help would be greatly appreciated. *I think this could be a very
useful Macro for anybody working in an Admin.


Thank you,


From Outlook, these work with Office 2010/64bit on Win7/64bit:

======================================
Public Sub MailSent_ExportToExcel()
Dim xlWorkbook As Excel.Workbook
Dim xlTargetRange As Excel.Range, Mail As Outlook.folder
Dim xlFileName As String, i As Object, j As Long, k As Integer

xlFileName = "D:\BC\Book1.xlsm"
Set xlWorkbook = Workbooks.Open(xlFileName)
Set xlTargetRange = [Sheet11!A30]

Set Mail = Session.GetDefaultFolder(olFolderSentMail)

For Each i In Mail.Items
* * j = j + 1
* * xlTargetRange(j, 1) = i.To
* * xlTargetRange(j, 2) = i.Subject
* * xlTargetRange(j, 3) = i.Body
* * xlTargetRange(j, 4) = i.SentOn
* * xlTargetRange(j, 5) = i.SenderName
* * For k = 1 To i.Attachments.Count
* * * * xlTargetRange(j, 5 + k) = i.Attachments(k)
* * Next
Next
xlWorkbook.Close (True)

End Sub
======================================

======================================
Public Sub MailReceived_ExportToExcel()
Dim xlWorkbook As Excel.Workbook
Dim xlTargetRange As Excel.Range, MailReceived As Outlook.folder
Dim xlFileName As String, i As Object, j As Long, k As Integer

xlFileName = "D:\BC\Book1.xlsm"
Set xlWorkbook = Workbooks.Open(xlFileName)
Set xlTargetRange = [Sheet11!A30]

Set MailReceived = ("Inbox ")

j = 1
xlTargetRange(j, 1) = "To"
xlTargetRange(j, 2) = "Subject"
xlTargetRange(j, 3) = "SentOn"
xlTargetRange(j, 4) = "SenderName"
xlTargetRange(j, 5) = "SenderEmailAddress"
xlTargetRange(j, 6) = "Body"

For Each i In MailReceived.Items
* * j = j + 1
* * xlTargetRange(j, 1) = i.To
* * xlTargetRange(j, 2) = i.Subject
* * xlTargetRange(j, 3) = i.SentOn
* * xlTargetRange(j, 4) = i.SenderName
* * xlTargetRange(j, 5) = i.SenderEmailAddress
* * 'xlTargetRange(j, 6) = i.Body
* * For k = 1 To i.Attachments.Count
* * * * xlTargetRange(1, 6 + k) = "Attach-" & k
* * * * xlTargetRange(j, 6 + k) = i.Attachments(k)
* * Next
Next
xlWorkbook.Close (True)

End Sub
========================================

Bruno


Thanks Bruno,
I'll give both a shot and let you know how it goes,
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
how to remove the outlook confirm window when use excel to send email from outlook? Tom Cai Excel Programming 3 March 4th 09 03:35 AM
Email using Outlook Richard Excel Programming 1 November 27th 07 03:35 PM
Outlook Email Nigel RS[_2_] Excel Programming 4 July 12th 06 12:41 PM
Email & Outlook Chris Excel Discussion (Misc queries) 0 March 14th 06 12:04 PM
Late Binding to Outlook from Excel: Outlook modifies email body Lenny Wintfeld Excel Programming 0 December 12th 04 04:03 PM


All times are GMT +1. The time now is 11:22 AM.

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"