¿Cómo se puede enviar una email respuesta desde excel VBA?

Espero y se encuentre bien,

Me refiero a su persona en pro de su amable ayuda y colaboración.

Actualmente desarrollo un proyecto sobre VBA en excel; consiste en la automatización de un formulario de correcciones a la facturación en el cual el mismo genera el salvado de un nuevo archivo en determinada carpeta compartida, y que a su vez este genere un email en respuesta a la solicitud de corrección y adjunte el previo archivo guardado.

A momento el código creado me genera el 75% de las tareas requeridas. Me genera el salvado automático, me genera un email y me adjunta el archivo guardado. Sin embargo al momento de enviar el email no genera una respuesta sobre el email recibido con la solicitud me genera un nuevo email.

Existe la posibilidad de que puedas colaborarme en la revisión del código y ver si es posible que la programación genere una respuesta sobre el correo recibido y no me cree uno nuevo.

Mil gracias de ante mano.

Detalle del código:

Dim ManagerName As String

Dim FormNumber As String

Dim AccountCode As String

Dim CustomerName As String

Dim TheLocationFile As String

Application.ScreenUpdating = False

Application.DisplayAlerts = False

'On Error Resume Next

Set OutlookApp = New Outlook.Application

DestinataryOne = Range("N9")

ManagerName = Range("N8")

FormNumber = Range("I7")

AccountCode = Range("B6")

CustomerName = Range("B7")

DestinataryTwo = Range("N7")

Subject = Range("N10")

ThePathname = Range("AJ1")

TheFileName = Range("AJ2")

TheLocationFile = Range("AI2")

Explanation = Range("S6")

Message = "<p><strong>Dear </strong></span>" & "<strong>" & ManagerName & "</strong></span>"

Message = Message & vbNewLine & "<p>Enclosed you will find adjustment form number: " & "<strong>" & FormNumber & "</strong>"

Message = Message & " for its respective approval or denial according to your review. In response to the correction request from the customer: " & "<strong>" & CustomerName & "</strong>"

Message = Message & ". (Falcon account code: " & "<strong>" & AccountCode & "</strong>" & ")."

Message = Message & vbNewLine & "<br /> Additional comments: " & Explanation & vbNewLine

Message = Message & vbNewLine & "<p>Cordially,</p>
" & vbNewLine

Message = Message & vbNewLine & "<p><strong>Accounts Receivable - Queries Team<br /></strong>Finance Department</p>
" & vbNewLine

Message = Message & vbNewLine & "<p><strong>DHL Aviation<br /></strong>Phone:+507 238-2000<br />email: <a href=mailto:[email protected]>[email protected]</a></p>
" & vbNewLine

Message = Message & vbNewLine & "<strong><u><a href=http://www.dhl.com/>http://www.dhl.com</a></u></strong></p>
"

Message = Message & vbNewLine & "<strong><u><a href=http://aviationcargo.dhl.com/>http://aviationcargo.dhl.com</a></u></strong></p>
"

Message = Message & vbNewLine & vbNewLine & "<p>This message is from DHL and may contain confidential business information. It is intended solely for the use of the individual to whom it is addressed. If you are not the intended recipient please contact the sender and delete this message and any attachment from your system. Unauthorized publication, use, dissemination, forwarding, printing or copying of this E-Mail and its attachments is strictly prohibited.</p>
"

Message = Message & vbNewLine & vbNewLine & "<p><strong><em>GO</em></strong><strong><em>GREEN</em></strong><strong>&ndash; </strong><strong>Climate Protection with DHL<br /> </strong>Please consider your environmental responsibility before printing this E-Mail.</p>

If Dir(TheLocationFile) <> "" Then

    Set MItem = OutlookApp.CreateItem(Outlook.Reply)

    With MItem

        .To = DestinataryOne

        .CC = "[email protected]" & "; " & DestinataryTwo

        .BCC = SCop

        .Subject = "RE: " & Subject

        .Attachments.Add (TheLocationFile)

        .HTMLBody = Message

        .send

        MsgBox ("El mensaje se envió con éxito"), vbInformation, "AR QUERIES AND HANDLING ©"

        End With

Else

    MsgBox "El archivo no ha sido guardado o ha sido eliminado de la carpeta compartida. No se ha enviado email. " & Err.Description, vbExclamation, " AR QUERIES AND HANDLING ©"

End If

Application.DisplayAlerts = True

Application.ScreenUpdating = True

End Sub

Añade tu respuesta

Haz clic para o