A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , , ,

Outlook Message Count - VBA Error - Multiple Inboxes





 
 
Thread Tools Display Modes
  #1  
Old January 27th 06, 04:47 PM posted to microsoft.public.outlook.program_vba
Ryan
external usenet poster
 
Posts: 1
Default Outlook Message Count - VBA Error - Multiple Inboxes

I am trying to get a count of how many messages per date I have in my
generic inboxes. I have multiple inboxes I manage and need to count the
messages by day. This code work for MY inbox only, not the generic inboxes.
Any help? Thanks!!

Const olFolderInbox = 6

Set objDictionary = CreateObject("Scripting.Dictionary")

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

Set colItems = objFolder.Items

For Each objItem in colItems
strDate = FormatDateTime(objItem.SentOn, vbShortDate)
If objDictionary.Exists(strDate) Then
objDictionary.Item(strDate) = objDictionary.Item(strDate) + 1
Else
objDictionary.Add strDate, "1"
End If
Next

colKeys = objDictionary.Keys

For Each strKey in colKeys
Wscript.Echo strKey, objDictionary.Item(strKey)
Next
Ads
  #2  
Old January 27th 06, 05:17 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,175
Default Outlook Message Count - VBA Error - Multiple Inboxes

YOu can use the Namespace.GetSharedDefaultFolder method to return the Inbox folder from other mailboxes where you have permission.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Ryan" wrote in message . ..
I am trying to get a count of how many messages per date I have in my
generic inboxes. I have multiple inboxes I manage and need to count the
messages by day. This code work for MY inbox only, not the generic inboxes.
Any help? Thanks!!

Const olFolderInbox = 6

Set objDictionary = CreateObject("Scripting.Dictionary")

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

Set colItems = objFolder.Items

For Each objItem in colItems
strDate = FormatDateTime(objItem.SentOn, vbShortDate)
If objDictionary.Exists(strDate) Then
objDictionary.Item(strDate) = objDictionary.Item(strDate) + 1
Else
objDictionary.Add strDate, "1"
End If
Next

colKeys = objDictionary.Keys

For Each strKey in colKeys
Wscript.Echo strKey, objDictionary.Item(strKey)
Next

  #3  
Old February 15th 06, 07:51 PM posted to microsoft.public.outlook.program_vba
Ryan
external usenet poster
 
Posts: 23
Default Outlook Message Count - VBA Error - Multiple Inboxes

Thanks for the help Sue -- I'm sorry that I don't quite understand though,
how would the coding look? I'm an extreme newbie to this! Do I need the
name of the actual inbox I'm trying to access?

"Sue Mosher [MVP-Outlook]" wrote:

YOu can use the Namespace.GetSharedDefaultFolder method to return the Inbox folder from other mailboxes where you have permission.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Ryan" wrote in message . ..
I am trying to get a count of how many messages per date I have in my
generic inboxes. I have multiple inboxes I manage and need to count the
messages by day. This code work for MY inbox only, not the generic inboxes.
Any help? Thanks!!

Const olFolderInbox = 6

Set objDictionary = CreateObject("Scripting.Dictionary")

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

Set colItems = objFolder.Items

For Each objItem in colItems
strDate = FormatDateTime(objItem.SentOn, vbShortDate)
If objDictionary.Exists(strDate) Then
objDictionary.Item(strDate) = objDictionary.Item(strDate) + 1
Else
objDictionary.Add strDate, "1"
End If
Next

colKeys = objDictionary.Keys

For Each strKey in colKeys
Wscript.Echo strKey, objDictionary.Item(strKey)
Next


  #4  
Old February 15th 06, 10:35 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,175
Default Outlook Message Count - VBA Error - Multiple Inboxes

What you need is the name of the *mailbox*, i.e. the user whose mailbox you want to access. The Help topic on GetSharedDefaultFolder has a complete example of the syntax.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Ryan" wrote in message ...
Thanks for the help Sue -- I'm sorry that I don't quite understand though,
how would the coding look? I'm an extreme newbie to this! Do I need the
name of the actual inbox I'm trying to access?

"Sue Mosher [MVP-Outlook]" wrote:

YOu can use the Namespace.GetSharedDefaultFolder method to return the Inbox folder from other mailboxes where you have permission.


"Ryan" wrote in message . ..
I am trying to get a count of how many messages per date I have in my
generic inboxes. I have multiple inboxes I manage and need to count the
messages by day. This code work for MY inbox only, not the generic inboxes.
Any help? Thanks!!

Const olFolderInbox = 6

Set objDictionary = CreateObject("Scripting.Dictionary")

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

Set colItems = objFolder.Items

For Each objItem in colItems
strDate = FormatDateTime(objItem.SentOn, vbShortDate)
If objDictionary.Exists(strDate) Then
objDictionary.Item(strDate) = objDictionary.Item(strDate) + 1
Else
objDictionary.Add strDate, "1"
End If
Next

colKeys = objDictionary.Keys

For Each strKey in colKeys
Wscript.Echo strKey, objDictionary.Item(strKey)
Next


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple inboxes, sent items etc Sam Outlook Express 5 March 8th 06 08:43 PM
2 .pst files, 2 inboxes with MSN email in Outlook Am Outlook - Installation 0 February 27th 06 04:14 AM
Error message when sending message in Outlook Vikes Outlook - General Queries 0 February 17th 06 10:02 PM
Error Message in Outlook Tony Pecoraro Outlook - General Queries 3 January 24th 06 03:43 PM
How do I prevent multiple inboxes from opening? hello Outlook - General Queries 0 January 9th 06 01:07 AM


All times are GMT +1. The time now is 10:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Loans - Mortgages - Refinance - Refinance - Web Advertising