Bonsoir,
Je souhaite insérer un lien hypertexte dans un message outlook.
J'ai bien remarqué la fonction _IELinkClickByText mais je n'arrive pas à la faire fonctionner.
En fait je ne sais pas quelle variable lui mettre en objet.
Merci pour vos éclaircissements;
Cordialement.
Insertion d'un lien hypertexte dans un message outlook
Règles du forum
- Merci de consulter la section "Règles du forum" et plus particulièrement "Règles et Mentions Légales du site autoitscript.fr" avant d'écrire un message.
- walkson
- Modérateur
- Messages : 1037
- Enregistré le : ven. 12 août 2011 19:49
- Localisation : Hurepoix
- Status : Hors ligne
Re: Insertion d'un lien hypertexte dans un message outlook
Bonjour,
En VBA, cela donnerait
Autrement dit, il faut écrire en html
En VBA, cela donnerait
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties.
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = _
"<HTML><BODY><a href='https://autoitscript.fr/forum/viewtopic.php?f=3&t=14352'>lien</a></BODY></HTML>"
.Display
End With
'Const olFormatHTML = 2
'Const olMailItem = 0
End Sub
'Creates a new e-mail item and modifies its properties.
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = _
"<HTML><BODY><a href='https://autoitscript.fr/forum/viewtopic.php?f=3&t=14352'>lien</a></BODY></HTML>"
.Display
End With
'Const olFormatHTML = 2
'Const olMailItem = 0
End Sub
Cordialement,
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Re: Insertion d'un lien hypertexte dans un message outlook
Salut,
Essai ça (il y a peut-être des ajustements)
Mettre ça en variables Globale:
Essai ça (il y a peut-être des ajustements)
Mettre ça en variables Globale:
; #Func _Email# ========================================================================================================
;
; ======================================================================================================================
Func _Email()
Local $oSecurityManager = ObjCreate("AddinExpress.Outlook.SecurityManager")
If IsObj($oSecurityManager) Then $oSecurityManager.DisableOOMWarnings = True
Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
$oOApp = ObjCreate("Outlook.Application")
$oOMail = $oOApp.CreateItem($olMailItem)
;$oOMail.Save
Local $ApplicationName = "Fonction Send Email par AutoIt avec lien HyperText"
With $oOMail
.To = $EmailTo
.Subject = "Le sujet de mon Email"
.BodyFormat = $olFormatHTML
.Importance = $olImportanceHigh
.HTMLBody = "<Font Size = 3 Face = Courier New Font Color = #FFFFFF><p Style = Background-Color:#A8BAD2>" & $ApplicationName & "</p></font>" _
& "<Font Face = Courier New Color = #FFFFFF><p Style = Background-Color:#6E8CB2>" & "Mail envoyé le " & _NowCalc() & "</p>" & "</Font>" _
& "<BR>" _
& "<style type=" & Chr(34) & "text/css" & Chr(34) & ">" & @CRLF _
& "table.table-style-three {" & @CRLF _
& "font-family:'Courier New', Arial;" & @CRLF _
& "font-size: 12px;" & @CRLF _
& "color: #333333;" & @CRLF _
& "border-width: 1px;" & @CRLF _
& "border-color: #3A3A3A;" & @CRLF _
& "border-collapse: collapse;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three th {" & @CRLF _
& "border-width: 1px;" & @CRLF _
& "padding: 8px;" & @CRLF _
& "border-style: solid;" & @CRLF _
& "border-color: #FFA6A6;" & @CRLF _
& "background-color: #3A5A82;" & @CRLF _ ;Couleur entête
& "color: #ffffff;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three tr:hover td {" & @CRLF _
& "cursor: pointer;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three tr:nth-child(even) td{" & @CRLF _
& "background-color: #F7CFCF;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three td {" & @CRLF _
& "border-width: 1px;" & @CRLF _
& "padding: 8px;" & @CRLF _
& "border-style: solid;" & @CRLF _
& "border-color: #FFA6A6;" & @CRLF _
& "background-color: #ffffff;" & @CRLF _
& "}" & @CRLF _
& "</style>" & @CRLF _
& "<HTML><BODY><a href='https://www.autoitscript.fr/forum/portal'>lien</a></BODY></HTML>" & @CRLF _
& "<BR>" & "<BR>" _
& "</table>" & @CRLF _
& "<Font Size = 1 Face = Arial Font Color = #0101DF>" & "Ce mail est généré automatiquement depuis " & $ApplicationName & " le " & @MDAY & "/" & @MON & "/" & @YEAR & " à " & @HOUR & ":" & @MIN & ":"& @SEC & "." & "</p>" & "</font>"
;.Display
.Send
EndWith
$oOApp = 0
EndFunc
;
; ======================================================================================================================
Func _Email()
Local $oSecurityManager = ObjCreate("AddinExpress.Outlook.SecurityManager")
If IsObj($oSecurityManager) Then $oSecurityManager.DisableOOMWarnings = True
Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
$oOApp = ObjCreate("Outlook.Application")
$oOMail = $oOApp.CreateItem($olMailItem)
;$oOMail.Save
Local $ApplicationName = "Fonction Send Email par AutoIt avec lien HyperText"
With $oOMail
.To = $EmailTo
.Subject = "Le sujet de mon Email"
.BodyFormat = $olFormatHTML
.Importance = $olImportanceHigh
.HTMLBody = "<Font Size = 3 Face = Courier New Font Color = #FFFFFF><p Style = Background-Color:#A8BAD2>" & $ApplicationName & "</p></font>" _
& "<Font Face = Courier New Color = #FFFFFF><p Style = Background-Color:#6E8CB2>" & "Mail envoyé le " & _NowCalc() & "</p>" & "</Font>" _
& "<BR>" _
& "<style type=" & Chr(34) & "text/css" & Chr(34) & ">" & @CRLF _
& "table.table-style-three {" & @CRLF _
& "font-family:'Courier New', Arial;" & @CRLF _
& "font-size: 12px;" & @CRLF _
& "color: #333333;" & @CRLF _
& "border-width: 1px;" & @CRLF _
& "border-color: #3A3A3A;" & @CRLF _
& "border-collapse: collapse;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three th {" & @CRLF _
& "border-width: 1px;" & @CRLF _
& "padding: 8px;" & @CRLF _
& "border-style: solid;" & @CRLF _
& "border-color: #FFA6A6;" & @CRLF _
& "background-color: #3A5A82;" & @CRLF _ ;Couleur entête
& "color: #ffffff;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three tr:hover td {" & @CRLF _
& "cursor: pointer;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three tr:nth-child(even) td{" & @CRLF _
& "background-color: #F7CFCF;" & @CRLF _
& "}" & @CRLF _
& "table.table-style-three td {" & @CRLF _
& "border-width: 1px;" & @CRLF _
& "padding: 8px;" & @CRLF _
& "border-style: solid;" & @CRLF _
& "border-color: #FFA6A6;" & @CRLF _
& "background-color: #ffffff;" & @CRLF _
& "}" & @CRLF _
& "</style>" & @CRLF _
& "<HTML><BODY><a href='https://www.autoitscript.fr/forum/portal'>lien</a></BODY></HTML>" & @CRLF _
& "<BR>" & "<BR>" _
& "</table>" & @CRLF _
& "<Font Size = 1 Face = Arial Font Color = #0101DF>" & "Ce mail est généré automatiquement depuis " & $ApplicationName & " le " & @MDAY & "/" & @MON & "/" & @YEAR & " à " & @HOUR & ":" & @MIN & ":"& @SEC & "." & "</p>" & "</font>"
;.Display
.Send
EndWith
$oOApp = 0
EndFunc
-
- Niveau 1
- Messages : 2
- Enregistré le : sam. 03 déc. 2016 18:14
- Localisation : Normandie
- Status : Hors ligne
Re: Insertion d'un lien hypertexte dans un message outlook
Bonjour,
Merci à Huges et à Walkson pour leurs réponses très pertinentes.
Je conserve les deux et je vais tenter d'intégrer l'une d'entre elles dans mon script.
Bravo et encore merci.
Cordialement.
Aston27.
Merci à Huges et à Walkson pour leurs réponses très pertinentes.
Je conserve les deux et je vais tenter d'intégrer l'une d'entre elles dans mon script.
Bravo et encore merci.
Cordialement.
Aston27.