Create appointment to custom (shared) outlook calendar

Status
Not open for further replies.
P

Paul

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
 
K

Ken Slovak - [MVP - Outlook]

Where is the calendar located? Is it in a different PST file, a delegate

Exchange mailbox, an Exchange public folder or what?

Try this to get information to provide so someone can help you. Select the

desired folder and make sure it's showing in an Outlook folder view. In

Outlook use Alt+F11 to open the Outlook VBA project. Make sure the Immediate

window is showing and in that window type the following:

? application.activeexplorer.currentfolder.folderpath

Copy that information into another post and then someone can guide you as to

how to get a handle to that folder.

"Paul" <Paul> wrote in message

news:AF88FBD8-2D24-4884-98E3-0933F01A21CB@microsoft.com...
> 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
 
P

Paul

Ken,

Thanks for the reply. I got it working using the getfolderid to determine

the correct calendar.

Cheers,

Paul
wrote:


> Where is the calendar located? Is it in a different PST file, a delegate
> Exchange mailbox, an Exchange public folder or what?

> Try this to get information to provide so someone can help you. Select the
> desired folder and make sure it's showing in an Outlook folder view. In
> Outlook use Alt+F11 to open the Outlook VBA project. Make sure the Immediate
> window is showing and in that window type the following:

> ? application.activeexplorer.currentfolder.folderpath

> Copy that information into another post and then someone can guide you as to
> how to get a handle to that folder.

> >

>

> "Paul" <Paul> wrote in message
> news:AF88FBD8-2D24-4884-98E3-0933F01A21CB@microsoft.com...
> > 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


> .
>
 
K

khu

Would you please post the solution, how did you solved the problem.

-Thanks
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
Chiba Create an appointment for all the members Outlook VBA and Custom Forms 1
Nessa Can't create new appointment Using Outlook 1
G Create an Appointment at the Contact's Address From Email Outlook VBA and Custom Forms 0
Diane Poremsky Create Task or Appointment and Insert Selected Text New Slipstick.com Articles 0
Diane Poremsky Create Appointment From Email Automatically New Slipstick.com Articles 0
M receive mail when appointment category changes and create task from appointment Outlook VBA and Custom Forms 0
B VBA Code to create appointment from email Outlook VBA and Custom Forms 1
Diane Poremsky Create an Outlook appointment from an email message New Slipstick.com Articles 4
Diane Poremsky Create an Appointment Diary New Slipstick.com Articles 0
J Create an appointment from Contact list with the Company name in the Subject line Using Outlook 1
M Create an Appointment from XL Spreadsheet in a Shared Calendar. Outlook VBA and Custom Forms 1
anoble1 How to create an email with a link to add a calendar appointment Using Outlook 1
T How to create meeting recurrences that are not available in the appointment screen? Using Outlook 1
I how to create appointment using saved template onto public folder shared calendar Using Outlook 3
B Create appointment/meeting from shared mailbox Using Outlook 2
M right click contact to create an appointment Using Outlook 4
A Create Appointment with Contact Using Outlook 4
R Create appointment skipping weekends and within a timeframe Outlook VBA and Custom Forms 1
S Create a clickable custom column field Outlook VBA and Custom Forms 0
O Create a custom contact form - questions before messing things up... Outlook VBA and Custom Forms 4
C Can't create Outlook data file Outlook Wishlist 0
L automaticaly create a teams meeting with a sync Using Outlook 0
D Can Exchange Admin Center create a pst for users email/contacts/calendar? Exchange Server Administration 0
S Create A Search Folder That Looks For Message Class? Outlook VBA and Custom Forms 0
F How to create phone number as links in notes of Contacts Using Outlook 2
A Create date folder and move messages daily Outlook VBA and Custom Forms 1
C Create new Message with shared contacts & BCC'ing recipients Outlook VBA and Custom Forms 0
O Multiple email accounts - hesitate to create a new profile Using Outlook 3
G Can't create Folder Groups in Outlook 2013 Using Outlook 0
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
F Delete/create/reset Exchange mailbox on Outlook.com Using Outlook.com accounts in Outlook 3
R Can not create folder to store specific emails in in Outlook for Mac Using Outlook 1
W Create Search Folder excluding Specific Email Addresses Using Outlook 5
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
K VBA BeforeItemMove event create rule to always move to its folder. Outlook VBA and Custom Forms 4
JackBlack What tools do you use to create the signature for email? Using Outlook 3
Rupert Dragwater How to create a new email with @outlook.com Using Outlook.com accounts in Outlook 32
F Should a new email account also create new contacts Using Outlook 2
D create an html table in outlook custom form 2010 using vba in MsAccess Outlook VBA and Custom Forms 7
R Outlook add-in to create new contact from an email. Using Outlook 0
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
Q Script to create a pst file for Archiving Using Outlook 1
Jennifer Murphy Can I create a Rule with Or'd conditions? Using Outlook 1
D Outlook macros to create meeting on shared calendar Outlook VBA and Custom Forms 10
G How do I create a custom pick list in VB for an outlook automated email? Outlook VBA and Custom Forms 1
L Create Custom Form Using Outlook 0
Diane Poremsky Create a Task when a Message is Flagged New Slipstick.com Articles 0
Stilgar Relsik Create a rule to copy text from an email and paste it in the subject line. Using Outlook 1
Diane Poremsky Create a custom field for Outlook messages New Slipstick.com Articles 0
Mark White vba to create a shared mailbox folder Outlook VBA and Custom Forms 3
Similar threads


















































Top