bonjour à tous,
j'ai une macro que je n'arrive pas à executer, vous pourriez m' expliquer pas à pas comment faire depuis la feuille de calcul et sur le module pour que cette macro soit opérationnelle. merci d'avance
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("Commentaire").Address Then
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = Range("Commentaire").Value
Courriel = "toncourriel@hotmail.com"
On Error Resume Next
With OutMail
.To = Courriel
.CC = ""
.BCC = ""
.Subject = "Commentaire d'un employé"
.Body = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub
j'ai une macro que je n'arrive pas à executer, vous pourriez m' expliquer pas à pas comment faire depuis la feuille de calcul et sur le module pour que cette macro soit opérationnelle. merci d'avance
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("Commentaire").Address Then
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = Range("Commentaire").Value
Courriel = "toncourriel@hotmail.com"
On Error Resume Next
With OutMail
.To = Courriel
.CC = ""
.BCC = ""
.Subject = "Commentaire d'un employé"
.Body = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub