comment puis je le deboguer ?
ma cellule "commentaire" est sur A1 de ma feuille
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("Commentaire").Address Then
Dim OutApp As Object, OutMail As Object, strBody As String, Courriel As String
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
ma cellule "commentaire" est sur A1 de ma feuille
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("Commentaire").Address Then
Dim OutApp As Object, OutMail As Object, strBody As String, Courriel As String
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