F
FA
Hi Freinds, I am using the following codes to create appointment and it
works fine. Now I want to add a functionality. Our team has one shared
Outlook Calender, is there anyway i can send Me.Resource,
Me.Test_Begin_Date, Me.Test_End_Date to the Shared Calender by
modifying some of the codes below.
Your help would be greatly Appreciated
On Error GoTo Err_cmdCreateAppt_Click
Dim objOl As Outlook.Application
Dim objItem As Outlook.AppointmentItem
Dim blnOlRunning As Boolean
On Error Resume Next
blnOlRunning = True
Set objOl = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set objOl = CreateObject("Outlook.Application")
blnOlRunning = True
Err.Clear
End If
On Error GoTo 0
Set objItem = objOl.CreateItem(olAppointmentItem)
With objItem
.Start = CDate(Me.txtApptDate) + CDate(Me.txtApptTime)
.Duration = Me.txtDuration * Me.ogDuration
.Subject = Me.txtSubject & vbNullString
.Body = Me.txtBody & vbNullString
If Len(Me.txtReminder & vbNullString) > 0 Then
.ReminderSet = True
.ReminderMinutesBeforeStart = Me.txtReminder * Me.ogPeriod
Else
.ReminderMinutesBeforeStart = 0
.ReminderSet = False
End If
.Save
End With
If blnOlRunning = True Then
' display the new item
objItem.Display
Else
objOl.Quit
End If
Exit_cmdCreateAppt_Click:
Set objItem = Nothing
Set objOl = Nothing
Exit Sub
Err_cmdCreateAppt_Click:
Select Case Err
Case 0
Case Else
MsgBox Err.Description
Resume Exit_cmdCreateAppt_Click
End Select
works fine. Now I want to add a functionality. Our team has one shared
Outlook Calender, is there anyway i can send Me.Resource,
Me.Test_Begin_Date, Me.Test_End_Date to the Shared Calender by
modifying some of the codes below.
Your help would be greatly Appreciated
On Error GoTo Err_cmdCreateAppt_Click
Dim objOl As Outlook.Application
Dim objItem As Outlook.AppointmentItem
Dim blnOlRunning As Boolean
On Error Resume Next
blnOlRunning = True
Set objOl = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set objOl = CreateObject("Outlook.Application")
blnOlRunning = True
Err.Clear
End If
On Error GoTo 0
Set objItem = objOl.CreateItem(olAppointmentItem)
With objItem
.Start = CDate(Me.txtApptDate) + CDate(Me.txtApptTime)
.Duration = Me.txtDuration * Me.ogDuration
.Subject = Me.txtSubject & vbNullString
.Body = Me.txtBody & vbNullString
If Len(Me.txtReminder & vbNullString) > 0 Then
.ReminderSet = True
.ReminderMinutesBeforeStart = Me.txtReminder * Me.ogPeriod
Else
.ReminderMinutesBeforeStart = 0
.ReminderSet = False
End If
.Save
End With
If blnOlRunning = True Then
' display the new item
objItem.Display
Else
objOl.Quit
End If
Exit_cmdCreateAppt_Click:
Set objItem = Nothing
Set objOl = Nothing
Exit Sub
Err_cmdCreateAppt_Click:
Select Case Err
Case 0
Case Else
MsgBox Err.Description
Resume Exit_cmdCreateAppt_Click
End Select