Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to add calendar item in outlook other than default calendar

Status
Not open for further replies.

psbsmms

Programmer
Dec 14, 2001
74
I have found several helpfull post here to achomplish what i am triiing to do.
1. Trying to add calendar item to outlook from access.
2. the calendar needs to be shared with all, no-exchange.
3. The calendsar needs to be the same on all computers because all the individuals add, edit and delete items, so it can't be anyones default calendar.

I have set up net folders and when i enter items directly into outlook they work fine.

When i try and automate the function useing code I found on here and Microsoft I can add to my default calendar but I can't seem to get it to add or even find the added on calendar. I am using Acess2k, windows xp pro, and no exchange server.

Here is my attemp(s) so far

i tried the post #705-662115, but it only appears to work in an exchange enviroment

Below is thge code I've been playing with, it has been through several revision and i thought i had it at one point and erased some of my other attemps. i thought the pick method would return me the folder to put it in and it does but either outlook or VB ignores the variable when adding the calendar item. This code below works to add to default calandar, howvever I need it added to the Job schedule calendar.

Dim appOutlook As Outlook.Application
Dim OutNamespace As Outlook.NameSpace
Dim MyItem As Object

Set appOutlook = New Outlook.Application
Set NameSpace = appOutlook.GetNamespace("MAPI").PickFolder
'Set MyNewFolder = NameSpace.Folders("Job schedule")
'Set myrecipient = NameSpace.PickFolder
'Set myrecipient = myrecipient.Folders("Job schedule")
'Set MyFolder = NameSpace.Folders(myrecipient)
Set MyItem = appOutlook.CreateItem(olAppointmentItem)

MyItem.MeetingStatus = olMeeting
MyItem.Subject = "test From Access"
MyItem.Location = "Store Name and Number"
MyItem.Start = #3/4/2005 8:00:00 AM#
MyItem.Duration = 4320
MyItem.Save

Any help would be appreciated
 
i have figured most of it out, I had to put the net folder shared calendar as a sub folder of the primary calendar and use the below code. i still get an error at the end that but setting the warnings to off works. i will continue to refine and see what happens. my next step is to figure out how to edit exsisting appointments.

Dim appOutlook As Outlook.Application
Dim OutNamespace As Outlook.NameSpace
Dim MyItem As Object

Set appOutlook = New Outlook.Application
Set NameSpace = appOutlook.GetNamespace("MAPI")
Set myfolder = NameSpace.GetDefaultFolder(9)
Set mynewfolder = myfolder.Folders("Job schedule")
Set MyItem = appOutlook.CreateItem(olAppointmentItem)

MyItem.MeetingStatus = olMeeting
MyItem.Subject = glbSubject
MyItem.Location = glbStoreAndLocation
MyItem.Start = "#" & glbStartDateTime & "#"
MyItem.Duration = glbDuration
DoCmd.SetWarnings False
Set mycopyitem = MyItem.Copy
mycopyitem.Move mynewfolder
DoCmd.SetWarnings True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top