PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Re: Create an Appointment in a Specific Folder

Reply

Re: Create an Appointment in a Specific Folder

 
Thread Tools Rate Thread
Old 18-12-2006, 03:01 PM   #1
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Create an Appointment in a Specific Folder


To create a new item in a non-default folder programmatically, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class parameter is optional.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"dch3" <dch3@discussions.microsoft.com> wrote in message news:9D9AAB62-B666-4DC4-9F61-5AF68DC520FB@microsoft.com...
> What is the syntax to create a new appointment in a specific folder? I've got
> this so far...
>
> Sub uploadSchedule()
>
> Dim objApp As Outlook.Application
> Dim nms As Outlook.Namespace
> Dim targetFolder As Outlook.MAPIFolder
> Dim objAppointmentItem As Outlook.AppointmentItem
> Dim intRow As Integer
>
> Set objApp = Outlook.Application
> Set nms = objApp.GetNamespace("MAPI")
> Set targetFolder = nms.PickFolder
>
> Debug.Print targetFolder.Name
>
> intRow = 2
>
> While intRow < 5
> Set objAppointmentItem = objApp.CreateItem(olAppointmentItem)
>
> With objAppointmentItem
> .Subject = Worksheets("upload").Range("A" & intRow).Value
> .Location = Worksheets("upload").Range("C" & intRow).Value
> .Start = Worksheets("upload").Range("E" & intRow).Value
> .End = Worksheets("upload").Range("F" & intRow).Value
> .Categories = "Show Schedule Upload"
> .Save
> End With
>
> Set objAppointmentItem = Nothing
> Debug.Print intRow
> intRow = intRow + 1
> Wend
>
> Set objAppointmentItem = Nothing
> Set objApp = Nothing
>
> End Sub

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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