Vaulcul
Vaulcul

Reputation: 37

Is there a VBA way to create a new calendar (not an appointment) in Outlook

I've looked and looked and I can't find any method to create/delete Calendar's in Outlook using MS Access VBA.

I've found lots and lots of walkthroughs on how to create an appointment (I've got that working very well now)... But nothing on the actual automated creation/deletion of a calendar.

I want to be able to cycle through calendar names in a table and either create or delete them on the fly.

I can understand that this might not be allowed due to security restrictions... So I'm also open to information on deleting all calendar appointment entries on a specific calendar.

Thanks for your help in advance.

Upvotes: 2

Views: 857

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

Calendar is just a folder in Outlook with the default Appointment items type. Try using the Delete method of the Folder class. Here is what MSDN states for the method:

In general, deleting a folder does not require first deleting the items in the folder. Deleting the folder also deletes all items in the folder. An exception would be if the folder is an Outlook folder that cannot be deleted, such as the Inbox and the Deleted Items folder. In such cases, you can delete only the items of the folder but not the folder itself. To delete all items in the Items collection of the folder, you must delete each item starting with the last item in the folder. For example, in the items collection of a folder, AllItems, if there are n number of items in the folder, start deleting the item at AllItems.Item(n), decrementing the index each time until you delete AllItems.Item(1).

Upvotes: 1

Related Questions