IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBA Outlook Discussion :

Erreur modification propriété AllDayEvent


Sujet :

VBA Outlook

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Décembre 2018
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Enseignant Chercheur

    Informations forums :
    Inscription : Décembre 2018
    Messages : 50
    Points : 29
    Points
    29
    Par défaut Erreur modification propriété AllDayEvent
    Je souhaiterai modifier modifier certains événements "journaliers" selon un pattern spécifique (en gros les anniversaire) pour les transformer en événement normal avec un début et une fin
    Mais que je modifier la propriété AllDayEvent, j'ai une erreur et le débogueur me dit que l'objet ne supporte par la méthode.
    Selon https://docs.microsoft.com/en-us/pre...%3dexchg.10%29, la modification est supportée et l'heure de début et de fin de l’événement devrait être automatiquement modifiée...

    Une idée? Sachant que le problème apparaît sur la ligne oAppt.AllDayEvent = False.
    Merci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  2. #2
    Expert éminent
    Avatar de Oliv-
    Homme Profil pro
    solution provider
    Inscrit en
    Mars 2006
    Messages
    4 087
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : solution provider

    Informations forums :
    Inscription : Mars 2006
    Messages : 4 087
    Points : 7 168
    Points
    7 168
    Billets dans le blog
    20
    Par défaut
    Bonsoir,
    en fait comme c'est un événement récurrent, il faut modifier la récurrence et pas le rdv lui même .


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    Set oPattern = oAppt.GetRecurrencePattern
        With oPattern
            .RecurrenceType = olRecursYearNth
            .DayOfWeekMask = olMonday
            .MonthOfYear = 6
            .Instance = 1
            .Occurrences = 10
            .Duration = 180
            .PatternStartDate = #6/1/2007#
            .StartTime = #2:00:00 PM#
            .EndTime = #5:00:00 PM#
        End With
        oAppt.Save

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo