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

Mailbox Counter



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 2nd 07, 04:06 PM posted to microsoft.public.outlook.program_vba
CMPTom
external usenet poster
 
Posts: 1
Default Mailbox Counter

Good Afternoon all,

I'm trying to acquire a VBA script for use in a macro that would be able to
tell me how many emails my account is recieving each day. I work in a busy
sales office, whereby 5/6 people all have access to this account. I've found
a code that could be useful through an affliated Microsoft site which i have
pasted underneath:

"Sub MailCounter()

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

End Sub"

However, when i attempt to run this, i get an 'Error 424: Object required'
message and it prompts me to look at the "Wscript.echo strKey,
objDictionary.Item(strKey)" piece of code.

Can anyone help with this please? either with the code i already have or
with an entirely different piece.

It's to be used within a Macro, so at the end of the day - any number of
people can activate it to get a reading of emails recieved for the day.

Thanks
Tom Clarkin
CMP Batteries, Bolton, UK.
Ads
  #2  
Old May 7th 07, 10:45 AM posted to microsoft.public.outlook.program_vba
nana
external usenet poster
 
Posts: 11
Default Mailbox Counter

Hello Tom,
I think you need to first create the object Wscript.
Or try to write WScript instead of Wscript. (S should be capital)
Not sure if that's the reason for it, but the JavaScript error should be
coming from there.


Regards,
nana


"CMPTom" wrote:

Good Afternoon all,

I'm trying to acquire a VBA script for use in a macro that would be able to
tell me how many emails my account is recieving each day. I work in a busy
sales office, whereby 5/6 people all have access to this account. I've found
a code that could be useful through an affliated Microsoft site which i have
pasted underneath:

"Sub MailCounter()

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

End Sub"

However, when i attempt to run this, i get an 'Error 424: Object required'
message and it prompts me to look at the "Wscript.echo strKey,
objDictionary.Item(strKey)" piece of code.

Can anyone help with this please? either with the code i already have or
with an entirely different piece.

It's to be used within a Macro, so at the end of the day - any number of
people can activate it to get a reading of emails recieved for the day.

Thanks
Tom Clarkin
CMP Batteries, Bolton, UK.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Counter stops at 6 greg Outlook and VBA 4 March 22nd 07 04:25 PM
Character Counter Paltrinieri Alejandro Outlook - Using Forms 0 March 14th 07 07:02 PM
Newsgroups unread items counter Rostislav Yevdyukhin Outlook - General Queries 2 October 20th 06 11:42 AM
Outlook 2004- where is counter for contact number of address? bpulpit Outlook - Using Contacts 1 October 17th 06 10:00 PM
how do i make a counter in an outlook form? Wassan Outlook - Using Forms 1 May 27th 06 03:21 PM


All times are GMT +1. The time now is 08:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.