1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Sub ChangeAppointment()
Dim oApp As Outlook.Application
Dim oCalFolder As Outlook.MAPIFolder
Dim oAppt As Outlook.AppointmentItem
Dim sOldText As String
Dim sNewText As String
Dim iCalChangedCount As Integer
Set oApp = Outlook.Application
' Check to be sure a Calendar folder was selected
Do
If Not (oCalFolder Is Nothing) Then
If (oCalFolder.DefaultItemType = olAppointmentItem) Then Exit Do
End If
MsgBox ("Please select a calendar folder from the following list.")
Set oCalFolder = Application.Session.PickFolder
On Error GoTo ErrHandler:
Loop Until oCalFolder.DefaultItemType = olAppointmentItem
' Loop through appointments in calendar, change text where necessary, keep count
iCalChangedCount = 0
For Each oAppt In oCalFolder.Items
If (Left(oAppt.Subject, 17) = "Anniversaire de V") Then
'Debug.Print "Changed: " & oAppt.Subject & " - " & oAppt.Start
'oAppt.Subject = Replace(oAppt.Subject, sOldText, sNewText)
oAppt.ReminderSet = True
oAppt.ReminderMinutesBeforeStart = 300 'min
oAppt.AllDayEvent = False
'oAppt.Start = oAppt.dOccuringDate & " 9:00:00 AM"
'oAppt.End = oAppt.dOccuringDate & " 6:00:00 PM"
'Change the Start and End Time as per Working Hours
oAppt.Save
MsgBox (oAppt.End)
iCalChangedCount = iCalChangedCount + 1
End If
Next |
Partager