PDA

View Full Version : After send email, write column already sent



marreco
06-14-2013, 04:04 PM
I have a code after being fired, will open a inputbox for each guide lines "Test"

happens that her column "L" if user click yes (yes to confirm the inputbox), I need to write the code in this line "sent"

p45cal
06-14-2013, 10:00 PM
...
.Save
.Send
End With
Range("L" & M).Value = "Sent"
End If
...

elsg
06-15-2013, 05:37 AM
Hi

I have this error

run time error '287'
application defined or object defined error

p45cal
06-15-2013, 06:21 AM
on which line?

elsg
06-15-2013, 06:24 AM
Hi
in this case after the error, I do not have a line painted yellow

p45cal
06-15-2013, 06:30 AM
Because this codeis in a sheet module and you're using Select then the sheet concerned must be the active sheet.

elsg
06-15-2013, 06:49 AM
I did the way you said, but still.

the code only generates the error when clicked on "Yes" in the message box that appears.

case click on "No" does not generate errors

p45cal
06-15-2013, 09:18 AM
I tried this with no error:Sub Auto_open()
Stop
Dim x As Integer, resultado As VbMsgBoxResult
Range("A12").Select
Selection.End(xlDown).Select
x = ActiveCell.Row
For M = 12 To x
If Range("L" & M) = "Send" Then
resultado = MsgBox("Deseja enviar email para o Fornecedor " & Range("N" & M).Value & "?" & vbCrLf _
& "*NF " & Range("E" & M).Value & ". Dias em aberto " & Range("K" & M).Value, vbYesNo)
If resultado = 6 Then

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myAttachments = myItem.Attachments

With myItem
.To = Range("M" & M).Value 'DESTINATÁRIO
.Subject = "Mensagem Automática! CONTROLE DE MERCADORIAS GUARARAPES" 'ASSUNTO
.Body = vbCrLf & vbCrLf _
& "Caro Cliente/Fornecedor: " & Range("N" & M).Value & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf _
& "Esta mensagem é automática, Por gentileza, solicitamos sua atenção para situação abaixo:" & vbCrLf & vbCrLf _
& "Em atendimento ao Art. 334 do RICMS/PR 6080/12, detectamos que se encontra pendente o documento abaixo relacionado: " & vbCrLf & vbCrLf _
& "*NF " & Range("E" & M).Value & " Emissão em: " & Range("i" & M).Value & " Item: " & Range("c" & M).Value & ", emitido a " & Range("K" & M).Value & " dias." & vbCrLf & vbCrLf _
& "Solicitamos a devolução fiscal para a devida regularização" & vbCrLf & vbCrLf _
& "Certos de contar com sua compreenssão aguardamos retorno" & vbCrLf & vbCrLf & vbCrLf & vbCrLf _
& "Em caso de dúvidas nos contatar artavés do Tel: (46) 3263-8347 ou através do email gleison@guararapes.com.br" & vbCrLf & vbCrLf & vbCrLf & vbCrLf _
& "Sds," & vbCrLf _
& "Dpto Fiscal" & vbCrLf _
& "www.guararapes.com.br" & vbCrLf _
& "Política de Privacidade. Esta mensagem (incluindo qualquer anexo) é CONFIDENCIAL e legitimamente protegida, somente podendo ser usada pelo indivíduo ou entidade a quem foi endereçada. Caso você a tenha recebido por engano, deverá devolve-la ao remetente e apagá-la. A disseminação, encaminhamento, uso, impressão ou cópia do conteúdo desta mensagem são expressamente proibidos." 'CORPO DO EMAIL
'.Save
'.Send
.display
End With
Range("L" & M).Value = "Sent"
End If
End If
Next M
End Sub

The only line I didn't try was .Send.

elsg
06-16-2013, 07:59 AM
Hellow
Very good!!..help me what i look....

Thank you!!!