I know how to create an appointment item in the Calendar, but it is placing the item in the default Calendar. How do I place that item in a Calendar that has been created.
You should be able to refer to it by name such as
<appobject and parent folders>.folders.item("FolderName"
where FolderName is the name of the folder you are trying to access.
hope this helps,
sdraper
Thanks for replying, I found that out, but when I write a new appointment item, it still goes to the default calendar. In the interim, I write the entry to the default calendar, then use the move property to move the item to the 'other' calendar. It seems to work now, but if there is another solution, I would love to know.
Set appOutLook = GetOutlook()
Set myNameSpace = appOutLook.GetNamespace("MAPI"
Set myFolder = myNameSpace.Folders("Test"
Set calFolder = myFolder.Folders("Calendar2"
Set calOutLook = appOutLook.CreateItem(olAppointmentItem)
With calOutLook
.ReminderSet = False
.Body = "Body"
.Start = StartDateTime
.Duration = 0
.Importance = olImportanceHigh
.Subject = "Subject"
.Save
.Move calFolder
End With
try changing the following line
Set calOutLook = appOutLook.CreateItem(olAppointmentItem)
to this
Set calOutLook = CalFolder.CreateItem(olAppointmentItem)
I think that will fix it. Even though you create a reference to Calendar2 when you create the appointmentitem you are referencing the application object which thinks you want to create in the default calendar folder. Give it a try!
hope this helps,
sdraper
No problem, we are allowed to get excited every now an then. The good news, that worked great. I overlooked the add property. I'm still learning interfacing with Outlook, this will help in the future. Thanks alot
Glad to help. If you want a book, try "Outlook 2000 VBA" by Dwayne Gifford isbn 1-861002-53-x
I picked it up on Ebay for about 10 bucks!
Also
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.