Possivel problema em macro

Edudinha

28-10-2014 16:39:52

Boa Tarde!! Colegas

Possuo esta macro abaixo, em alguns micros ela envia automaticamente ao alterar a celula, em outros tem que clicar duas vezes na celula para enviar e as vezes nem envia, o que sera que esta avendo algum pode me dar um help ? Sera que é falta de algum procedimento, atualmente estou usando o windows7 e office 2010.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim OutApp As Object
Dim OutMail As Object
Dim texto As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

linha = ActiveCell.Row - 1
If Target.Address = "$K$" & linha Or Target.Address = "$Q$" & linha Then

If Plan3.Cells(linha, 11) = "INAPTO" Or Plan3.Cells(linha, 11) = "APTO" Or Plan3.Cells(linha, 11) = "ASO VENCIDO" Or Plan3.Cells(linha, 17) = "INAPTO" Or Plan3.Cells(linha, 17) = "APTO" Or Plan3.Cells(linha, 17) = "ASO VENCIDO" Then
texto = "Prezado(a) " & Plan3.Cells(linha, 1) & "," & vbCrLf & vbCrLf & _
"O A.S.O. da Empresa " & Plan3.Cells(linha, 2) & " referente ao colaborador " & _
Plan3.Cells(linha, 3) & " foi alterado." & vbCrLf & _
" Veja informações abaixo:" & vbCrLf & _
" Status: " & Plan3.Cells(linha, 11) & "-" & " NR 10" & "/" & Plan3.Cells(linha, 17) & "-" & " Altura" & vbCrLf & _
" Ação tomada: " & Plan3.Cells(linha, 22) & vbCrLf & vbCrLf & _
"Atenciosamente," & vbCrLf & _
"Medicina do Trabalho"
End If

With OutMail
.To = Plan3.Cells(linha, 1)
.CC = ""
.BCC = ""
.Subject = "Alteração A.S.O"
.Body = texto
.Display 'Utilize Send para enviar o email sem abrir o Outlook
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub