Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count mails in Excel

Hello,

I try to make statistics about received mails automatically stored in
a specific folder in OL2007 (rule).

I found on the net a procedure which list the mails in the default
Inbox by I am not able to adapt it to a specific folder of my personal
*.pst file (Archives/EDI).

So does anybody could help me to customize this code.

Thancks by advance,

Best regards

Philippe


Sub LitMessagerie()
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olxFolder = olNs.GetDefaultFolder(6) '
olns.GetDefaultFolder(olFolderInbox)
Sheets("Litmessagerie").Select
On Error Resume Next
n = 2
For Each i In olxFolder.Items
Cells(n, 1) = i.Subject
Cells(n, 2).ClearComments
Cells(n, 2).AddComment Text:=Replace(i.Body, Chr(13), "")
Cells(n, 2).Comment.Shape.Height = 150
Cells(n, 2).Comment.Shape.Width = 300
Cells(n, 3) = i.SenderName
Cells(n, 4) = i.CreationTime
n = n + 1
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Count mails in Excel

You can play with this

Sub test()
Dim ns As Namespace
Dim myfolder As MAPIFolder

Set ns = GetNamespace("MAPI")
Set myfolder = ns.PickFolder

If Not myfolder Is Nothing Then
If myfolder.Items.Count = 0 Then
MsgBox "There are no messages in this folder : " & myfolder, _
vbInformation, "Nothing Found"
Else
MsgBox myfolder.Items.Count
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"berapard" wrote in message ...
Hello,

I try to make statistics about received mails automatically stored in
a specific folder in OL2007 (rule).

I found on the net a procedure which list the mails in the default
Inbox by I am not able to adapt it to a specific folder of my personal
*.pst file (Archives/EDI).

So does anybody could help me to customize this code.

Thancks by advance,

Best regards

Philippe


Sub LitMessagerie()
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olxFolder = olNs.GetDefaultFolder(6) '
olns.GetDefaultFolder(olFolderInbox)
Sheets("Litmessagerie").Select
On Error Resume Next
n = 2
For Each i In olxFolder.Items
Cells(n, 1) = i.Subject
Cells(n, 2).ClearComments
Cells(n, 2).AddComment Text:=Replace(i.Body, Chr(13), "")
Cells(n, 2).Comment.Shape.Height = 150
Cells(n, 2).Comment.Shape.Width = 300
Cells(n, 3) = i.SenderName
Cells(n, 4) = i.CreationTime
n = n + 1
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
send mails from excel Jithu Excel Discussion (Misc queries) 3 May 31st 07 05:02 PM
Send multiple e-mails with excel Appache Excel Discussion (Misc queries) 1 November 11th 06 02:08 AM
How to copy mails to Excel Saravanan New Users to Excel 1 September 26th 05 06:32 AM
Sending mails on behalf in excel Pavol Uhrin Excel Programming 2 July 22nd 05 07:53 AM
Excel/PowerPoint E-Mails kiza[_14_] Excel Programming 3 October 12th 04 10:29 PM


All times are GMT +1. The time now is 06:01 PM.

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

About Us

"It's about Microsoft Excel"