![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |