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

can a macro copy all meetings of a category to another calendar



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 3rd 06, 05:08 AM posted to microsoft.public.outlook.program_vba
Gaurav
external usenet poster
 
Posts: 1
Default can a macro copy all meetings of a category to another calendar

I need a mechanism to enable users to run a macro that will copy all their
appointments of a certain category (e.g., "board meeting") to a shared
calendar.

or

a macro that runs through each users calendar and scans for appointments in
that category and copies to a central calendar.
  #2  
Old October 3rd 06, 05:47 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default can a macro copy all meetings of a category to another calendar

Try the macro below. It'll prompt you to choose the destination Calendar,
and use the default Calendar as the source for items to copy from. Change
the "Test" comparison string to look for a Category of your choice.

Sub CopyAppointmentsByCategoryToSharedCalendar()
Dim objMyCal As Outlook.MAPIFolder, objDestCal As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItem As Outlook.AppointmentItem, objNewItem As
Outlook.AppointmentItem

Set objNS = Application.GetNamespace("MAPI")
Set objMyCal = objNS.GetDefaultFolder(olFolderCalendar) 'Get default
Calendar folder

'Select Destination Calendar to copy appointments to
Set objDestCal = objNS.PickFolder
If objDestCal.DefaultItemType olAppointmentItem Then
MsgBox "You must choose a Calendar folder.", vbOKOnly +
vbExclamation, "Invalid Folder"
Exit Sub
End If


For Each objItem In objMyCal.Items
If InStr(objItem.Categories, "Test") 0 Then
Set objNewItem = objItem.Copy
objNewItem.Move objDestCal
End If
Next

Set objMyCal = Nothing
Set objDestCal = Nothing
Set objNS = Nothing
Set objItem = Nothing
Set objNewItem = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Gaurav" wrote:

I need a mechanism to enable users to run a macro that will copy all their
appointments of a certain category (e.g., "board meeting") to a shared
calendar.

or

a macro that runs through each users calendar and scans for appointments in
that category and copies to a central calendar.

 




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
How do I select only one category for printing calendar items? CrabbyOldLady Outlook - Calandaring 2 September 15th 16 08:25 AM
Copy centain contacts to new folder based on category Bob Day Outlook - Using Contacts 0 July 24th 06 10:41 PM
How do I sort my calendar in Category view by subject, then date? lafngrrl Outlook - Calandaring 6 February 2nd 06 03:10 AM
Printing a calendar listing by a single category BigBlueMan Outlook - Calandaring 1 January 18th 06 11:10 PM
How to email a category of calendar events to another person SCS Jim Fox Outlook - Calandaring 0 January 18th 06 05:35 PM


All times are GMT +1. The time now is 07:54 AM.


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.