envio fichero adjunto
Publicado por josepf (68 intervenciones) el 22/06/2005 16:05:50
Hola a todos!
Se puede enviar un e-mail con fichero adjunto?
Gracias
Se puede enviar un e-mail con fichero adjunto?
Gracias
Valora esta pregunta
0
Sub EnviarCorreoConAdjunto()
Dim objOutlook As Object
Dim objMail As Object
Dim adjunto As String
' Ruta y nombre del archivo adjunto
adjunto = "C:\Ruta\Archivo.pdf"
' Crear instancia de la aplicación de Outlook
Set objOutlook = CreateObject("Outlook.Application")
' Crear un nuevo correo electrónico
Set objMail = objOutlook.CreateItem(0)
With objMail
' Configurar los campos del correo electrónico
.Subject = "Correo con archivo adjunto"
.Body = "Adjunto se encuentra el archivo que solicitaste."
.To = "destinatario@example.com"
' Adjuntar el archivo al correo
.Attachments.Add adjunto
' Enviar el correo electrónico
.Send
End With
' Liberar recursos
Set objMail = Nothing
Set objOutlook = Nothing
MsgBox "El correo se ha enviado correctamente."
End Sub