Jump to content
Fórum Script Brasil
  • 0

Erro com minha macro


Rafaveloz

Question

 

"Este e meu codigo ate o primeiro momento, esse primeiro sub e do botão enviar, minha macro deveria, enviar um email para o destinatario q estaria presente na coluna 1 , toda vez q o status da coluna 6 mudasse para para Realizar compra, com apenas as as suas linhas respectivas (couluna(2) a (6)); seria isso galera.

Sub Enviar()

 

Dim EnviarPara As String

    Dim Mensagem As String

        EnviarPara = ThisWorkbook.Sheets(1).Cells(i, 1)

       

            Mensagem = ThisWorkbook.Sheets(1).Cells(i, 3)

            Envia_Emails EnviarPara, Mensagem

        End If

 

End Sub

 

 

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 = "$F$" & linha Then

If Plan1.Cells(linha, 6) = "Realizar Compra" Then

texto = "Prezado(a) " & Plan1.Cells(linha, 1) & "." & vbCrLf & vbCrLf & _

"O estoque atual e semanal consta: " & Plan1.Cells(linha, 2) & Plan1.Cells(linha, 3) & Plan1.Cells(linha, 4) & Plan1.Cells(linha, 5) & Plan1.Cells(linha, 6) & _

"Rafael. INF" & vbCrLf

 

End If

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      652k
×
×
  • Create New...