XL 2013 Ajouter un lien hypertexte dans la macro qui envoi une invitation outlook

Sbed

XLDnaute Nouveau
Bonjour,
Je souhaite joindre un lien hypertexte dans mon invitation outlook envoyée mais je ne trouve pas comment l'écrire. J'ai essayé avec .htmlBody mais ça ne fonctionne pas...

Code:
Sub inviter_texte()
Dim messagerie As Object, invitation As Object, participant As Object, montexte As String, cel As Range
Dim ligne As Long
    Set messagerie = CreateObject("Outlook.Application")
    Set invitation = messagerie.CreateItem(1)
    Workbooks("Outil perso.xlsm").Sheets("Feuil3").Select
    
    corps = corps & "<HTML> <a href="" adresse de mon fichier "" > ici </a> </HTML>"
    
    With invitation
        .MeetingStatus = 1
        .Subject = Range("inv_obj").Value
        .Location = Range("inv_lieu").Value
        .Start = Range("inv_date").Value + Range("inv_heure").Value
        .Duration = Range("inv_durée").Value * 24 * 60
        If Range("inv_rappel").Value > 0 Then
            .ReminderSet = True
            .ReminderMinutesBeforeStart = Range("inv_rappel").Value
        Else
            .ReminderSet = False
        End If

            Set participant = .Recipients.Add(Range("Listeboxsortie").Value)

        .Body = corps
        .Send

    End With

End Sub
 

fanch55

XLDnaute Barbatruc
Bonjour,
VB:
Sub inviter_texte()
    
    With CreateObject("Outlook.Application").CreateItem(1)
        .MeetingStatus = 1
        .Subject = Range("inv_obj").Value
        .Location = Range("inv_lieu").Value
        .Start = Range("inv_date").Value + Range("inv_heure").Value
        .Duration = Range("inv_durée").Value * 24 * 60
        If Range("inv_rappel").Value > 0 Then
            .ReminderSet = True
            .ReminderMinutesBeforeStart = Range("inv_rappel").Value
        Else
            .ReminderSet = False
        End If

      ' Set participant = .Recipients.Add(Range("Listeboxsortie").Value)
      
      '  Il faut absolument faire un display au préalable pour accèder au WordEditor
        .display
    
        Cible = "https:/........../....../......"
        Set Wd = .GetInspector.WordEditor
        With Wd
            .Range.Text = "Ceci est ma 1ère ligne avec 2 retours à la ligne" & vbLf & vbLf
            .Range.InsertParagraphAfter
            .Range.Hyperlinks.Add Anchor:=.Paragraphs(.Paragraphs.Count).Range, _
                                  TextToDisplay:="Link", Address:=Cible
            .Range.InsertParagraphAfter
            .Paragraphs(.Paragraphs.Count).Range.Text = "Ceci est ma dernière ligne "
        End With
       ' .Send
    End With

End Sub
 

Discussions similaires

Statistiques des forums

Discussions
311 720
Messages
2 081 900
Membres
101 834
dernier inscrit
Jeremy06510