Consulting

Results 1 to 9 of 9

Thread: After send email, write column already sent

  1. #1
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location

    After send email, write column already sent

    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"
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    [vba]...
    .Save
    .Send
    End With
    Range("L" & M).Value = "Sent"
    End If
    ...
    [/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Hi

    I have this error
    run time error '287'
    application defined or object defined error

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    on which line?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    Hi
    in this case after the error, I do not have a line painted yellow

  6. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Because this codeis in a sheet module and you're using Select then the sheet concerned must be the active sheet.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  7. #7
    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

  8. #8
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    I tried this with no error:[VBA]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
    [/VBA]
    The only line I didn't try was .Send.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  9. #9
    Hellow
    Very good!!..help me what i look....

    Thank you!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •