appointment entry - public calendar from access


G

Guest

at the moment i am exporting some dates into an appointment from access using
a command button which does this ---
Private Sub cmdAddAppt_Click()
On Error GoTo Add_Err
'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
'Exit the procedure if appointment has been added to Outlook.
Dim objOutlook As Outlook.Application


Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = Me!Starthire
.Duration = Me!Days
.Subject = Me!JobNo
.end = Me!Endhire
If Not IsNull(Me!Text223) Then .Body = Me!Text223
If Not IsNull(Me!City) Then .Location = Me!City

.Save
.Close (olSave)
End With
'Release the AppointmentItem object variable.
Set objAppt = Nothing
'Release the object variables.
Set objOutlook = Nothing
Set objRecurPattern = Nothing
'Set the AddedToOutlook flag, save the record, display
'a message.
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub



However this puts it into the personal calendar and i need it to go into the
a public calendar...

I found this code that should work but i cant get them to work together...

Dim myFolder As Object


Set myNameSpace = myOlApp.GetNamespace("MAPI")

Set myFolder = myNameSpace.Folders("Public Folders")
Set myFolder = myFolder.Folders("All Public Folders")
Set myFolder = myFolder.Folders("name of folder")
'If the folder is just below the All Public Folders location. If it is
'elsewhere you keep adding Folders references until you hit the folder
'you want.

Set myFolderItems = myFolder.Items
Set objAppt = myFolderItems.Add(olAppointmentItem)

' olAppointmentItem is standard outlook form. If using custom form it must
be published in Organizational Forms
Library.

Can someone help me put it together so they work??

Thanks...

William
 
Ad

Advertisements

P

Pete D.

As your export to private folder works I would try posting in the outlook
newsgroup. They could probally be more able to help you with referencing
folders in outlook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top