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 :

Envoie automatique de rendez-vous outllook


Sujet :

VBA Outlook

  1. #1
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut Envoie automatique de rendez-vous outllook
    Bonjour à tous ceux qui me répondront dans le but de m'aider.

    Voici ce que je sais faire:
    Envoyer automatiquement des invitations Outlook via un email à partir d'un fichier Excel. C'est-à-dire que quand je clique sur l'adresse mail de machin@hotmail.fr du fichier excel ça envoie automatiquement un mail.

    Concernant la partie du haut j'arrive à le faire via une macro donc aucun soucis.

    Maintenant le problème ou je bloque:


    Grosso modo :
    Quand j'envoie un mail à une personne avec un fichier Excel, je veux qu'en ouvrant le fichier Excel, le destinataire reçoit une demande de réunion outlook (avec acceptation automatique si possible)

    J'espère avoir été clair. Si ce n'est pas le cas je pourrais développer

    Merci d'avance

  2. #2
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Développeur VBA/C#/VB.Net/Power Platform
    Inscrit en
    Juillet 2007
    Messages
    14 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur VBA/C#/VB.Net/Power Platform
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 593
    Points : 34 250
    Points
    34 250
    Par défaut
    Bonjour,

    tu souhaites que l'invitation soit créée à l'ouverture d'un classeur excel ou bien sur un clic particulier ?
    Quand j'envoie un mail à une personne avec un fichier Excel, je veux qu'en ouvrant le fichier Excel, le destinataire reçoit une demande de réunion outlook (avec acceptation automatique si possible)
    l'acceptation automatique c'est plutôt intrusif comme méthode, non
    Cycle de vie d'un bon programme :
    1/ ça fonctionne 2/ ça s'optimise 3/ ça se refactorise

    Pas de question technique par MP, je ne réponds pas

    Mes ouvrages :
    Apprendre à programmer avec Access 2016, Access 2019 et 2021

    Apprendre à programmer avec VBA Excel
    Prise en main de Dynamics 365 Business Central

    Pensez à consulter la FAQ Excel et la FAQ Access

    Derniers tutos
    Excel et les paramètres régionaux
    Les fichiers Excel binaires : xlsb,

    Autres tutos

  3. #3
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Bonjour merci de m'avoir répondu.

    En effet c'est un peu "intrusif" mais je souhaite cela

  4. #4
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Bonjour,

    tu souhaites que l'invitation soit créée à l'ouverture d'un classeur excel ou bien sur un clic particulier ?

    Je souhaite que l'invitation soit créée à l'ouverture d'un classeur Excel.

  5. #5
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Développeur VBA/C#/VB.Net/Power Platform
    Inscrit en
    Juillet 2007
    Messages
    14 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur VBA/C#/VB.Net/Power Platform
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 593
    Points : 34 250
    Points
    34 250
    Par défaut
    Ok,

    Sais-tu déjà comment créer une invitation en VBA ?
    Cycle de vie d'un bon programme :
    1/ ça fonctionne 2/ ça s'optimise 3/ ça se refactorise

    Pas de question technique par MP, je ne réponds pas

    Mes ouvrages :
    Apprendre à programmer avec Access 2016, Access 2019 et 2021

    Apprendre à programmer avec VBA Excel
    Prise en main de Dynamics 365 Business Central

    Pensez à consulter la FAQ Excel et la FAQ Access

    Derniers tutos
    Excel et les paramètres régionaux
    Les fichiers Excel binaires : xlsb,

    Autres tutos

  6. #6
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Bonjour oui je sais le faire via un fichier Excel. Mais j'ai laissé la macro à mon bureau. Je pourrais la poster lundi

  7. #7
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Voici la macro:

    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
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    Option Explicit
     
    Sub Convoquer_par_ICS()
     
    ' ===========
    ' paramétrage
    Const col_date = 2    ' numéro des colonnes où se trouvent les informations
    Const col_debut = 3
    Const col_fin = 4
    Const col_action = 5  ' servira de test (envoi fichier .ics si vide), sinon mémorise l'action
     
    Const titre = "Réunion de service"
    Const texte = "Merci"
     
    Const destinataire = "tartenpion@hotmail.fr" ' le(s) destinataire(s) de ces invitations
    ' fin paramétrage
    ' ===============
     
    Dim messagerie As Object
    Dim email As Object
    Dim cel As Object
    Dim chemin As String
    chemin = Environ("temp")
     
    Set messagerie = CreateObject("Outlook.Application")
     
    With ActiveSheet
        For Each cel In .Range("A2:" & "A" & .Range("A" & Application.Rows.Count).End(xlUp).Row)
            If cel.Value <> "" And cel.Offset(0, -1 + col_action).Value = "" Then
                If cel.Offset(0, -1 + col_date) < Now() Then
                    cel.Offset(0, -1 + col_action) = "date échue"
                ElseIf cel.Offset(0, -1 + col_debut) = "" Or cel.Offset(0, -1 + col_fin) = "" Then
                    cel.Offset(0, -1 + col_action) = ""
                Else
     
                    Close #1
                    Open chemin & "\invitation.ics" For Output As #1
     
                    Print #1, "BEGIN:VCALENDAR"
                    Print #1, "BEGIN:VEVENT"
                    Print #1, "DTSTART:" & Application.Text(cel.Offset(0, -1 + col_date), "YYYYMMDD") & "T" & Application.Text(cel.Offset(0, -1 + col_debut), "HHMMSS") ' & "Z"
                    Print #1, "DTSTAMP:" & Application.Text(Now(), "YYYYMMDD") & "T" & Application.Text(Now(), "HHMMSS") ' & "Z"
                    Print #1, "DTEND:" & Application.Text(cel.Offset(0, -1 + col_date), "YYYYMMDD") & "T" & Application.Text(cel.Offset(0, -1 + col_fin), "HHMMSS") ' & "Z"
                    Print #1, "LOCATION;ENCODING=QUOTED-PRINTABLE:" & cel.Value
                    Print #1, "UID:"
                    Print #1, "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & titre
                    Print #1, "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & texte
                    Print #1, "PRIORITY:3"
                    Print #1, "SEQUENCE:0"
                    Print #1, "BEGIN:VALARM"
                    Print #1, "TRIGGER:-PT30M"
                    Print #1, "ACTION:DISPLAY"
                    Print #1, "DESCRIPTION:Rappel " & titre
                    Print #1, "END:VALARM"
                    Print #1, "END:VEVENT"
                    Print #1, "END:VCALENDAR"
     
                    Close #1
     
                    Set email = messagerie.CreateItem(0)
                    With email
                        .To = destinataire
                        .Subject = titre
                        .body = texte
                        .Attachments.Add chemin & "\invitation.ics"
                        .send
                    End With
                    Set email = Nothing
     
                    cel.Offset(0, -1 + col_action).Value = "Mail préparé par " & Environ("UserName") & " le " & Application.Text(Now(), "DD/MM/YYYY HH:MM")
     
                End If
            End If
            Cells(cel.Row + 1, 1).Select
        Next cel
    End With
     
    Set messagerie = Nothing
     
    On Error Resume Next
    Kill chemin & "\invitation.ics"
     
    End Sub



    Voilà

  8. #8
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Développeur VBA/C#/VB.Net/Power Platform
    Inscrit en
    Juillet 2007
    Messages
    14 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur VBA/C#/VB.Net/Power Platform
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 593
    Points : 34 250
    Points
    34 250
    Par défaut
    Salut,

    il faut simplement lancer cette macro lors de l'ouverture du classeur

    A mettre donc dans Workbook_Open()
    Cycle de vie d'un bon programme :
    1/ ça fonctionne 2/ ça s'optimise 3/ ça se refactorise

    Pas de question technique par MP, je ne réponds pas

    Mes ouvrages :
    Apprendre à programmer avec Access 2016, Access 2019 et 2021

    Apprendre à programmer avec VBA Excel
    Prise en main de Dynamics 365 Business Central

    Pensez à consulter la FAQ Excel et la FAQ Access

    Derniers tutos
    Excel et les paramètres régionaux
    Les fichiers Excel binaires : xlsb,

    Autres tutos

  9. #9
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Bonjour,

    merci de votre retour.

    A un moment vous énoncez:
    A mettre donc dans Workbook_Open()

    C'est-à-dire ? Je ne comprends pas ou ce champ apparaît

  10. #10
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Développeur VBA/C#/VB.Net/Power Platform
    Inscrit en
    Juillet 2007
    Messages
    14 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur VBA/C#/VB.Net/Power Platform
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 593
    Points : 34 250
    Points
    34 250
    Cycle de vie d'un bon programme :
    1/ ça fonctionne 2/ ça s'optimise 3/ ça se refactorise

    Pas de question technique par MP, je ne réponds pas

    Mes ouvrages :
    Apprendre à programmer avec Access 2016, Access 2019 et 2021

    Apprendre à programmer avec VBA Excel
    Prise en main de Dynamics 365 Business Central

    Pensez à consulter la FAQ Excel et la FAQ Access

    Derniers tutos
    Excel et les paramètres régionaux
    Les fichiers Excel binaires : xlsb,

    Autres tutos

  11. #11
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Merci je viens de voir que suis je maladroit :s


    Du coup c'est là que je coince:

    Quand j'envoie un mail à une personne avec un fichier Excel, je veux qu'en ouvrant le fichier Excel, le destinataire reçoit une demande de réunion outlook (avec acceptation automatique si possible)

    A l'heure actuelle quand je le fais, la personne doit cliquer sur la macro pour avoir le rendez-vous et ensuite elle doit accepter.

    Or ce que je veux c'est qu'en ouvrant le fichier, cela lui ajoute un rendez vous sur Outlook.

    J'espère qu'on m'a compris

  12. #12
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Développeur VBA/C#/VB.Net/Power Platform
    Inscrit en
    Juillet 2007
    Messages
    14 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur VBA/C#/VB.Net/Power Platform
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 593
    Points : 34 250
    Points
    34 250
    Par défaut
    Quel est ton code dans Excel présentement ?
    Cycle de vie d'un bon programme :
    1/ ça fonctionne 2/ ça s'optimise 3/ ça se refactorise

    Pas de question technique par MP, je ne réponds pas

    Mes ouvrages :
    Apprendre à programmer avec Access 2016, Access 2019 et 2021

    Apprendre à programmer avec VBA Excel
    Prise en main de Dynamics 365 Business Central

    Pensez à consulter la FAQ Excel et la FAQ Access

    Derniers tutos
    Excel et les paramètres régionaux
    Les fichiers Excel binaires : xlsb,

    Autres tutos

  13. #13
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Bonjour désolé du laps de temps j'étais en vacances :s

    voici le code en question:
    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
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    Private Sub Workbook_Open()
    Option Explicit
     
    Sub Convoquer_par_ICS()
     
    ' ===========
    ' paramétrage
    Const col_date = 2    ' numéro des colonnes où se trouvent les informations
    Const col_debut = 3
    Const col_fin = 4
    Const col_action = 5  ' servira de test (envoi fichier .ics si vide), sinon mémorise l'action
     
    Const titre = "Petit déjeuner"
    Const texte = "Merci"
     
    Const destinataire = "moi@moi.fr" ' le(s) destinataire(s) de ces invitations
    ' fin paramétrage
    ' ===============
     
    Dim messagerie As Object
    Dim email As Object
    Dim cel As Object
    Dim chemin As String
    chemin = Environ("temp")
     
    Set messagerie = CreateObject("Outlook.Application")
     
    With ActiveSheet
        For Each cel In .Range("A2:" & "A" & .Range("A" & Application.Rows.Count).End(xlUp).Row)
            If cel.Value <> "" And cel.Offset(0, -1 + col_action).Value = "" Then
                If cel.Offset(0, -1 + col_date) < Now() Then
                    cel.Offset(0, -1 + col_action) = "date échue"
                ElseIf cel.Offset(0, -1 + col_debut) = "" Or cel.Offset(0, -1 + col_fin) = "" Then
                    cel.Offset(0, -1 + col_action) = ""
                Else
     
                    Close #1
                    Open chemin & "\invitation.ics" For Output As #1
     
                    Print #1, "BEGIN:VCALENDAR"
                    Print #1, "BEGIN:VEVENT"
                    Print #1, "DTSTART:" & Application.Text(cel.Offset(0, -1 + col_date), "YYYYMMDD") & "T" & Application.Text(cel.Offset(0, -1 + col_debut), "HHMMSS") ' & "Z"
                    Print #1, "DTSTAMP:" & Application.Text(Now(), "YYYYMMDD") & "T" & Application.Text(Now(), "HHMMSS") ' & "Z"
                    Print #1, "DTEND:" & Application.Text(cel.Offset(0, -1 + col_date), "YYYYMMDD") & "T" & Application.Text(cel.Offset(0, -1 + col_fin), "HHMMSS") ' & "Z"
                    Print #1, "LOCATION;ENCODING=QUOTED-PRINTABLE:" & cel.Value
                    Print #1, "UID:"
                    Print #1, "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & titre
                    Print #1, "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & texte
                    Print #1, "PRIORITY:3"
                    Print #1, "SEQUENCE:0"
                    Print #1, "BEGIN:VALARM"
                    Print #1, "TRIGGER:-PT30M"
                    Print #1, "ACTION:DISPLAY"
                    Print #1, "DESCRIPTION:Rappel " & titre
                    Print #1, "END:VALARM"
                    Print #1, "END:VEVENT"
                    Print #1, "END:VCALENDAR"
     
                    Close #1
     
                    Set email = messagerie.CreateItem(0)
                    With email
                        .To = destinataire
                        .Subject = titre
                        .body = texte
                        .Attachments.Add chemin & "\invitation.ics"
                        .send
                    End With
                    Set email = Nothing
     
                    cel.Offset(0, -1 + col_action).Value = "Mail préparé par " & Environ("UserName") & " le " & Application.Text(Now(), "DD/MM/YYYY HH:MM")
     
                End If
            End If
            Cells(cel.Row + 1, 1).Select
        Next cel
    End With
     
    Set messagerie = Nothing
     
    On Error Resume Next
    Kill chemin & "\invitation.ics"
     
    End Sub

  14. #14
    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
    Je suis pas sûr d'avoir compris ce que tu veux faire !

    tu as un fichier excel, qui te permet d'envoye un autre fichier exel par email et quand la personne ouvre ce dernier ca doit envoyer une invitation à une autre personne ?

    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
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    Private Sub Workbook_Open()
     
    ' ===========
    ' paramétrage
    Const col_date = 2    ' numéro des colonnes où se trouvent les informations
    Const col_debut = 3
    Const col_fin = 4
    Const col_action = 5  ' servira de test (envoi fichier .ics si vide), sinon mémorise l'action
     
    Const titre = "Petit déjeuner"
    Const texte = "Merci"
     
    Const destinataire = "moi@moi.fr" ' le(s) destinataire(s) de ces invitations
    ' fin paramétrage
    ' ===============
     
    Dim messagerie As Object
    Dim email As Object
    Dim cel As Object
    Dim chemin As String
    chemin = Environ("temp")
     
    Set messagerie = CreateObject("Outlook.Application")
     
    With ActiveSheet
        For Each cel In .Range("A2:" & "A" & .Range("A" & Application.Rows.Count).End(xlUp).Row)
            If cel.Value <> "" And cel.Offset(0, -1 + col_action).Value = "" Then
                If cel.Offset(0, -1 + col_date) < Now() Then
                    cel.Offset(0, -1 + col_action) = "date échue"
                ElseIf cel.Offset(0, -1 + col_debut) = "" Or cel.Offset(0, -1 + col_fin) = "" Then
                    cel.Offset(0, -1 + col_action) = ""
                Else
     
                    Close #1
                    Open chemin & "\invitation.ics" For Output As #1
     
                    Print #1, "BEGIN:VCALENDAR"
                    Print #1, "BEGIN:VEVENT"
                    Print #1, "DTSTART:" & Application.Text(cel.Offset(0, -1 + col_date), "YYYYMMDD") & "T" & Application.Text(cel.Offset(0, -1 + col_debut), "HHMMSS") ' & "Z"
                    Print #1, "DTSTAMP:" & Application.Text(Now(), "YYYYMMDD") & "T" & Application.Text(Now(), "HHMMSS") ' & "Z"
                    Print #1, "DTEND:" & Application.Text(cel.Offset(0, -1 + col_date), "YYYYMMDD") & "T" & Application.Text(cel.Offset(0, -1 + col_fin), "HHMMSS") ' & "Z"
                    Print #1, "LOCATION;ENCODING=QUOTED-PRINTABLE:" & cel.Value
                    Print #1, "UID:"
                    Print #1, "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & titre
                    Print #1, "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & texte
                    Print #1, "PRIORITY:3"
                    Print #1, "SEQUENCE:0"
                    Print #1, "BEGIN:VALARM"
                    Print #1, "TRIGGER:-PT30M"
                    Print #1, "ACTION:DISPLAY"
                    Print #1, "DESCRIPTION:Rappel " & titre
                    Print #1, "END:VALARM"
                    Print #1, "END:VEVENT"
                    Print #1, "END:VCALENDAR"
     
                    Close #1
     
                    Set email = messagerie.CreateItem(0)
                    With email
                        .To = destinataire
                        .Subject = titre
                        .body = texte
                        .Attachments.Add chemin & "\invitation.ics"
                        .send
                    End With
                    Set email = Nothing
     
                    cel.Offset(0, -1 + col_action).Value = "Mail préparé par " & Environ("UserName") & " le " & Application.Text(Now(), "DD/MM/YYYY HH:MM")
     
                End If
            End If
            Cells(cel.Row + 1, 1).Select
        Next cel
    End With
     
    Set messagerie = Nothing
     
    On Error Resume Next
    Kill chemin & "\invitation.ics"
     
    End Sub

  15. #15
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Ce que je souhaite exactement faire:

    Créer un fichier Excel avec une macro.
    L'envoyer par mail à une autre personne et quand cette dernière l'ouvre, cela va lui créer une invitation sur outlook grâce à la macro

  16. #16
    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
    Et pourquoi pas lui envoyer directement cette invitation ?

  17. #17
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    Tout simplement car je veux que ça lui crée "impose" sans qu'il puisse refuser ou mettre en provisoire

  18. #18
    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
    Mouais ....

    Il faut quand même que des conditions soient réunies pur que cela marche, déjà il doit ouvrir le fichier excel et activer les macros !

    il ne faut pas créer un Email mais directement un rdv


    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
    Sub CreateAppt()
        Dim myItem As Object
        Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient
     
        Set myItem = Application.CreateItem(olAppointmentItem)
        myItem.MeetingStatus = olMeeting
        myItem.Subject = "Strategy Meeting"
        myItem.Location = "Conf Rm All Stars"
        myItem.Start = #9/24/2009 1:30:00 PM#
        myItem.Duration = 90
        Set myRequiredAttendee = myItem.Recipients.Add("Nate Sun")
        myRequiredAttendee.Type = olRequired
        Set myOptionalAttendee = myItem.Recipients.Add("Kevin Kennedy")
        myOptionalAttendee.Type = olOptional
        Set myResourceAttendee = myItem.Recipients.Add("Conf Rm All Stars")
        myResourceAttendee.Type = olResource
        myItem.Display
        myItem.Send
    End Sub

  19. #19
    Candidat au Club
    Homme Profil pro
    contrôleur de gestion
    Inscrit en
    Avril 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : contrôleur de gestion
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2018
    Messages : 15
    Points : 4
    Points
    4
    Par défaut
    merci mais quand je test la macro le destinataire doit accepter l'invit.

    Je veux l'imposer c'est-à-dire que l'invit se greffe automatiquement dans son calendrier

  20. #20
    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
    donc c'est plutot un RDV qu'une réunion.

    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
    Sub CreateAppt()
        Dim myItem As Object
        Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient
     
        Set myItem = Application.CreateItem(olAppointmentItem)
        myItem.MeetingStatus = olNonMeeting
        myItem.Subject = "Strategy Meeting"
        myItem.Location = "Conf Rm All Stars"
        myItem.Start = #6/15/2018 1:30:00 PM#
        myItem.Duration = 90
     
        'pour l'afficher
        'myItem.Display
        myItem.Save
    End Sub

    si tu as les droits d'écriture/ création dans l'agenda de la personne tu peux directement lui créer le rdv.

    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
    Sub Creation_rdv_autre_calendrier()
        Dim myNamespace As Outlook.NameSpace
        Dim myRecipient As Outlook.Recipient
        Dim CalendarFolder As Outlook.Folder
     
        Set myNamespace = Application.GetNamespace("MAPI")
        Set myRecipient = myNamespace.CreateRecipient("TOTO")
        myRecipient.Resolve
        If myRecipient.Resolved Then
     
            Set CalendarFolder = _
            myNamespace.GetSharedDefaultFolder _
                                 (myRecipient, olFolderCalendar)
     
            Dim myItem As Object
            Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient
     
            Set myItem = CalendarFolder.Items.add
            myItem.MeetingStatus = olNonMeeting
            myItem.Subject = "Strategy Meeting"
            myItem.Location = "Conf Rm All Stars"
            myItem.Start = #6/15/2018 1:30:00 PM#
            myItem.Duration = 90
     
            'pour l'afficher
            'myItem.Display
            myItem.Save
     
        Else
            MsgBox "erreur"
        End If
    End Sub

Discussions similaires

  1. [XL-2016] Envoie automatique de rendez-vous outllook
    Par Slowdown dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 02/05/2018, 15h57
  2. Dynamics CRM V4 : envoi rendez-vous à clients extérieurs
    Par Marie40200 dans le forum Microsoft Dynamics CRM
    Réponses: 1
    Dernier message: 28/06/2013, 11h22
  3. Rendez-vous outllook avec plusieurs personnes
    Par Raikko68 dans le forum Macros et VBA Excel
    Réponses: 0
    Dernier message: 26/06/2012, 20h28
  4. [OL-2007] Envoi mail différé suite à un rendez vous
    Par khally44 dans le forum Outlook
    Réponses: 0
    Dernier message: 29/03/2012, 16h13
  5. [O-07] Gerer automatique add/supr/modif rendez-vous
    Par Yepazix dans le forum Outlook
    Réponses: 1
    Dernier message: 31/01/2009, 01h39

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