A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Calandaring
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Create appointment to custom (shared) outlook calendar



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 3rd 10, 08:28 AM posted to microsoft.public.outlook.calendaring
paul
external usenet poster
 
Posts: 197
Default Create appointment to custom (shared) outlook calendar

Hi,

I'm using access 2003

I'm looking for some code to create appointments into a shared outlook
calendar.

We've got several shared calendars and I need to post appointments into a
specific one using dates and times from our access database.

I've got the following code, but this puts the appointments in my personal
calendar;

I can't figure out how to modify this code to make it work for me,

Anyone any ideas?

Cheers,

Paul

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.
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
'Add a new appointment.
Else
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!ApptStartDate & " " & Me!ApptTime
..Duration = Me!ApptLength
..AllDayEvent = True
..Subject = Me!Appt
If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!Apptlocation) Then .Location = Me!Apptlocation
If Me!Apptreminder Then
..ReminderMinutesBeforeStart = Me!ReminderMinutes
..ReminderSet = True
End If
'Set objRecurPattern = .GetRecurrencePattern

'With objRecurPattern
'.RecurrenceType = olRecursWeekly
'.Interval = 1
'Once per week
'You can hard-wire in these dates or get the
'information from text boxes, as used here.
'.PatternStartDate = #12/1/2003#
'.PatternStartDate = Me!ApptStartDate
'.PatternEndDate = #12/30/2003#
'.PatternEndDate = Me!ApptEndDate
'End With
..Save
..Close (olSave)
End With
'Release the AppointmentItem object variable.
Set objAppt = Nothing
End If
'Release the object variables.
Set objOutlook = Nothing
' Set objRecurPattern = Nothing
'Set the AddedToOutlook flag, save the record, display
'a message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Ads
  #2  
Old February 3rd 10, 03:19 PM posted to microsoft.public.outlook.calendaring
Diane Poremsky [MVP]
external usenet poster
 
Posts: 12,991
Default Create appointment to custom (shared) outlook calendar

You should repost this in the program_vba group on this server.

--
Diane Poremsky [MVP - Outlook]
Outlook Tips: http://www.outlook-tips.net/
Outlook & Exchange Solutions Center: http://www.slipstick.com/

Outlook Tips by email:


EMO - a weekly newsletter about Outlook and Exchange:


How many email accounts are in your main Outlook profile?
http://forums.slipstick.com/showthread.php?t=36602

"Paul" wrote in message
...
Hi,

I'm using access 2003

I'm looking for some code to create appointments into a shared outlook
calendar.

We've got several shared calendars and I need to post appointments into a
specific one using dates and times from our access database.

I've got the following code, but this puts the appointments in my personal
calendar;

I can't figure out how to modify this code to make it work for me,

Anyone any ideas?

Cheers,

Paul

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.
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
'Add a new appointment.
Else
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!ApptStartDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.AllDayEvent = True
.Subject = Me!Appt
If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!Apptlocation) Then .Location = Me!Apptlocation
If Me!Apptreminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If
'Set objRecurPattern = .GetRecurrencePattern

'With objRecurPattern
'.RecurrenceType = olRecursWeekly
'.Interval = 1
'Once per week
'You can hard-wire in these dates or get the
'information from text boxes, as used here.
'.PatternStartDate = #12/1/2003#
'.PatternStartDate = Me!ApptStartDate
'.PatternEndDate = #12/30/2003#
'.PatternEndDate = Me!ApptEndDate
'End With
.Save
.Close (olSave)
End With
'Release the AppointmentItem object variable.
Set objAppt = Nothing
End If
'Release the object variables.
Set objOutlook = Nothing
' Set objRecurPattern = Nothing
'Set the AddedToOutlook flag, save the record, display
'a message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create appointment to custom (shared) outlook calendar Paul Outlook and VBA 3 May 10th 10 11:07 PM
Can I create custom field in the Calendar Appointment view? wajie Outlook - Calandaring 3 December 10th 08 09:53 PM
Create appointment item in shared calendar Adi[_2_] Add-ins for Outlook 1 November 24th 08 04:05 PM
Create Custom Appointment with VBA ZootRot Outlook - Calandaring 1 February 8th 08 11:00 AM
how to create custom appointment sjsdoc Outlook - Calandaring 3 January 2nd 07 04:31 PM


All times are GMT +1. The time now is 11:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.