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

Counting days



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 18th 06, 06:46 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 3
Default Counting days

Hi there

Is it possible to count the number of days a certain label type occurs
in a calendar?

Regards

Ian

Ads
  #2  
Old November 19th 06, 08:02 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Counting days

Yes. Use an AdvancedSearch to do that. It's the easiest way.

Set up the search criteria by opening a dialog for a custom calendar view.
Click Filter and go to the Advanced tab. Use the All Appointments setting to
add Label = whatever as a filter. Go to the SQL tab and check the box to use
only that. Copy the SQL criteria and that's your AdvancedSearch filter. Make
the search folder the calendar folder name and get the Count of the returned
Results collection.

An alternative would be to use the filter as a Restrict filter on the Items
collection of the folder using the "@SQL="filter undocumented syntax. Get
the Count of the returned Items collection.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
ups.com...
Hi there

Is it possible to count the number of days a certain label type occurs
in a calendar?

Regards

Ian


  #3  
Old November 21st 06, 08:27 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 3
Default Counting days


Thanks for the Help Ken

I have a run into a couple of problems trying this. I am using

Sub SearchCalendar()

Dim objSch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF1 As String = "urn:schemas:calendar:location = 'Kish
Island'"

Const strS1 As String = "IJM Travel Calendar"
Set objSch = Application.AdvancedSearch(Scope:=strS1,
Filter:=strF1, SearchSubFolders:=False, Tag:="SubjectSearch")
While blnSearchComp = False
DoEvents
Wend
Set rsts = objSch.Results

MsgBox rsts.Count



End Sub
(straight out of the Online Help)

I end up with an error in the set objSch line which I assume is the way
the strF1 string has been set, is there anything there that ive messed
up???

secondly , I can this will work fine for counting the number of events
that meet the search but where I have events running multiple days will
it not just report this as 1 event not duration??

Once again your help is appreciated

Cheers

Ian

  #4  
Old November 21st 06, 08:27 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 3
Default Counting days

Thanks for the Help Ken

I have a run into a couple of problems trying this. I am using

Sub SearchCalendar()

Dim objSch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF1 As String = "urn:schemas:calendar:location = 'Kish
Island'"

Const strS1 As String = "IJM Travel Calendar"
Set objSch = Application.AdvancedSearch(Scope:=strS1,
Filter:=strF1, SearchSubFolders:=False, Tag:="SubjectSearch")
While blnSearchComp = False
DoEvents
Wend
Set rsts = objSch.Results

MsgBox rsts.Count



End Sub
(straight out of the Online Help)

I end up with an error in the set objSch line which I assume is the way
the strF1 string has been set, is there anything there that ive messed
up???

secondly , I can see this will work fine for counting the number of
events that meet the search but where I have events running multiple
days will it not just report this as 1 event not duration??

Once again your help is appreciated

Cheers

Ian

  #5  
Old November 21st 06, 04:09 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Counting days

If you have spaces in your search scope you need to enclose the string in
single quotes:

Const strS1 As String = "'IJM Travel Calendar'"

The same would apply for the filter string.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
ps.com...

Thanks for the Help Ken

I have a run into a couple of problems trying this. I am using

Sub SearchCalendar()

Dim objSch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF1 As String = "urn:schemas:calendar:location = 'Kish
Island'"

Const strS1 As String = "IJM Travel Calendar"
Set objSch = Application.AdvancedSearch(Scope:=strS1,
Filter:=strF1, SearchSubFolders:=False, Tag:="SubjectSearch")
While blnSearchComp = False
DoEvents
Wend
Set rsts = objSch.Results

MsgBox rsts.Count



End Sub
(straight out of the Online Help)

I end up with an error in the set objSch line which I assume is the way
the strF1 string has been set, is there anything there that ive messed
up???

secondly , I can this will work fine for counting the number of events
that meet the search but where I have events running multiple days will
it not just report this as 1 event not duration??

Once again your help is appreciated

Cheers

Ian


 




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
OE not counting new messages correctly with IMAP accounts [email protected] Outlook Express 7 August 7th 06 12:50 PM
Counting Attachments in Messages Chris Rhodes Outlook and VBA 5 June 21st 06 05:57 PM
outlook is miss counting contacts, why Rosalind Outlook - Calandaring 0 April 13th 06 08:12 PM
Counting meetings monthly/annually yiftach Outlook - Calandaring 2 February 25th 06 03:04 PM
Outlook should have a function for counting the number of days Bruce McGinn Outlook - Calandaring 0 January 30th 06 02:01 PM


All times are GMT +1. The time now is 12:52 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.