Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Enviar mail con Excel desde Outlook con hoja adjunta


(adsbygoogle = window.adsbygoogle || []).push({});

Este es uno de otros ejemplos que se publicaron recientemente, que se relacionan con el envío de mails utilizando Outlook y denominados, envio de mails utilizando Outlookenvio de mail mediante Outlook adjuntando todo el libro y como enviar mail con Excel utilizando Outlook y agregando un link, hyperlink o hipertexto

Antes de seguir recomiendo leer un excelente libro sobre Excel que te ayudará operar las planillas u hojas de cálculo, haz click acá, si quieres aprender sobre Excel, en inglés, entonces debes hacer click here. Si lo que necesitas es aprender o profundizar sobre la programación de macros con VBA este es unos de los mejores cursos on line que he visto en internet.

  

La codificación que se encuentra más abajo, como así también en el libro de ejemplo, que podrás descargar en forma GRATUITA desde el link del final; permite mandar un mail utilizando Excel adjuntando como archivo una hoja del libro sobre el que se está trabajando, este código con una pequeña modificación permite adjuntar cualquier libro no solo en el cual estemos trabajando actualmente.

El correo destinatario se obtiene de la celda «E3», pero se puede escribir directamente en el código, el sujeto y cuerpo del mensaje se escriben directamente en el código, luego de realizar el procedimiento anterior se envía el mail, al enviarse el código establece si hubo un error o no al enviar el mail en caso que no haya habido error sale un msgbox avisando sobre el envío del mail, caso contrario sale un cuadro de diálogo que expone el error ocurrido.

El tema de enviar mail con Excel es algo muy solicitado al pretender automatizar tareas mediante macros de VBA, anteriormente se ha publicado como enviar un mail con Excel, como crear alertas y enviar mailmacro emite aviso y envía mail a varios destinatarios; pero todas estas macros hacían referencia a configurar directamente el servidor SMTP de Gmail, Yahoo o Hotmail; a diferencia de lo publicado en el post que muestra un ejemplo sobre como enviar mail con Excel mediante Outlook y adjuntando una hoja del libro actual.

Al final hay un link desde donde podrás descargar el ejemplo, si el mismo te sirvió no olvides colaborar para seguir manteniendo y publicando mas ejemplos de macros para automatizar Excel.

El vídeo que sigue muestra una explicación más detallada y gráfica de la macro presentada, recomiendo observar para una más fácil comprensión de la macro; suscribe a nuestra web desde la parte superior derecha de la página ingresando tu mail y a nuestro canal de You Tube para recibir en tu correo vídeos explicativos sobre macros interesantes, como  por ejemplo como copiar varias tablas vinculadas de Excel a Wordcomo ejecutar una macro dependiendo del valor de una celdapasar datos de listbox a hoja de Excelbuscar en listbox mientras escribes en textboxcrear indice a hojas del mismo libro y al menú principalconectar Excel con Access e insertar datos y muchos ejemplos más.

function onYtEvent(payload) {
if (payload.eventType == ‘subscribe’) {
// Add code to handle subscribe event.
} else if (payload.eventType == ‘unsubscribe’) {
// Add code to handle unsubscribe event.
}
if (window.console) { // for debugging only
window.console.log(‘YT event: ‘, payload);
}
}

Código que se inserta en un userform

Sub SendMailbyOutlookCSheet()
On Error Resume Next
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim OA, OM As Object
Dim NA As Variant
Dim Path, TD, fn, mydoc As String
TD = Format(Date, «ddmmyyyy»)
Path = ThisWorkbook.Path & «»
fn = ActiveSheet.Name
mydoc = Path & fn & «.xlsx»
Dest = Cells(3, «E»)
Sheets(fn).Copy
ActiveWorkbook.SaveAs Filename:=mydoc, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
Set OA = CreateObject(«Outlook.Application»)
Set OM = OA.CREATEITEM(0)
With OM
    .To = Dest ‘Debes agregar mail destinatario ej «xxxxx@gmail.com
    .CC = «»
    .BCC = «»
    .Subject = «Reporte de » & fn & » mensuales»
    .Body = «Estimado, en el archivo adjunto se encuentra el reporte de » & fn & » al » & TD & » confirmar recepción»
    .attachments.Add mydoc
    .Send
End With
MsgBox «El mail fue enviado con éxito», vbInformation, «AVISO»
Kill mydoc
Set OM = Nothing
Set OA = Nothing
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Si te fue de utilidad puedes INVITARME UN CAFÉ y de esta manera ayudar a seguir manteniendo la página, CLICK para descargar en ejemplo en forma gratuita.


(adsbygoogle = window.adsbygoogle || []).push({});

If this post was helpful INVITE ME A COFFEE and so help keep up the page, CLICK to download free example.

Si te gustó por favor compártelo con tus amigos
If you liked please share it with your friends      

Entradas relacionadas

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Comentarios (35)

WOW just what I was searching for. Came here by searching for 코인카지노

Responder

Hey There. I found your blog using msn. This is a very well written article.
I will be sure to bookmark it and return to
read more of your useful info. Thanks for the post.
I’ll certainly comeback.

Responder

Tremendous things here. I’m very glad to peer your article.
Thanks a lot and I am having a look ahead to touch you.
Will you kindly drop me a mail?

Responder

Do you have a spam problem on this blog; I also am a blogger,
and I was wanting to know your situation; many of us have
created some nice procedures and we are looking to swap techniques with others,
please shoot me an e-mail if interested.

Responder

Superb website you have here but I was curious about if you knew of any message boards that cover the
same topics discussed here? I’d really like to be a part of online community where I can get responses from other experienced individuals that share the same interest.

If you have any recommendations, please let me know.
Cheers!

Responder

Remarkable things here. I am very happy to look your post.
Thanks a lot and I am having a look forward to contact you.
Will you please drop me a e-mail?

Responder

Excellent goods from you, man. I’ve understand your stuff previous to and you are just too magnificent.
I really like what you have acquired here, really like what you are saying and the way in which you say it.
You make it entertaining and you still take care of to keep it wise.
I can’t wait to read far more from you. This is actually a terrific website.

Responder

Oh my goodness! Amazing article dude! Thank you, However I am experiencing
issues with your RSS. I don’t know why I am unable to
subscribe to it. Is there anybody having similar RSS issues?

Anyone that knows the solution can you kindly respond?

Thanx!!

Responder

It’s a shame you don’t have a donate button! I’d without
a doubt donate to this superb blog! I guess for now i’ll settle for
bookmarking and adding your RSS feed to my Google account.
I look forward to fresh updates and will share this site
with my Facebook group. Chat soon!

Responder

Great delivery. Great arguments. Keep up the good work.

Responder

What i do not understood is in truth how you are not really much more well-liked than you may be right now.
You are so intelligent. You realize thus
significantly in relation to this topic, produced me in my opinion consider it from a
lot of varied angles. Its like men and women aren’t involved until it is
something to do with Woman gaga! Your individual stuffs nice.
At all times deal with it up!

Responder

An intriguing discussion is definitely worth comment.
I believe that you ought to publish more on this issue, it may not be a taboo matter but
usually people do not speak about such subjects.

To the next! Kind regards!!

Responder

May I simply say what a relief to find a person that genuinely knows what they are
discussing over the internet. You definitely know how to bring an issue to light and
make it important. A lot more people need to look at this and understand this side of the story.

I can’t believe you aren’t more popular given that you certainly possess the
gift.

Responder

I loved as much as you will receive carried out right here.

The sketch is attractive, your authored material stylish.
nonetheless, you command get bought an impatience over that
you wish be delivering the following. unwell unquestionably come further formerly again as exactly
the same nearly very often inside case you shield this
increase.

Responder

Does your site have a contact page? I’m having trouble locating it but, I’d like
to send you an email. I’ve got some ideas
for your blog you might be interested in hearing. Either way, great blog
and I look forward to seeing it develop over time.

Responder

I’m writing to make you know of the fabulous encounter my wife’s child undergone going through the blog. She realized a good number of things, not to mention what it’s like to have an excellent giving spirit to make certain people just learn certain extremely tough subject areas. You undoubtedly surpassed readers’ desires. Many thanks for presenting the useful, trustworthy, revealing and as well as easy tips about this topic to Sandra.

Responder

Greetings from Colorado! I’m bored at work so I decided to browse your site
on my iphone during lunch break. I enjoy the information you present here and can’t wait to take a look when I get home.

I’m shocked at how fast your blog loaded
on my phone .. I’m not even using WIFI, just 3G .. Anyhow, amazing site!

Responder

Hi everyone, it’s my first go to see at this site, and paragraph
is in fact fruitful for me, keep up posting these types of posts.

Responder

Appreciate this post. Let me try it out.

Responder

Wow, this post is nice, my younger sister is analyzing such things, thus I am
going to let know her.

Responder

Hi there! I know this is kinda off topic however , I’d figured I’d ask.

Would you be interested in trading links or maybe guest authoring a blog
article or vice-versa? My site discusses a lot of the same
topics as yours and I think we could greatly benefit from
each other. If you might be interested feel free to send me an e-mail.

I look forward to hearing from you! Wonderful blog by the way!

Responder

Great delivery. Great arguments. Keep up the good effort.

Responder

If some one needs to be updated with latest technologies after that he must
be visit this website and be up to date every day.

Responder

You’re so cool! I don’t believe I have read through a single thing like this before.
So nice to discover someone with original thoughts on this
topic. Really.. thank you for starting this up. This site
is one thing that’s needed on the web, someone with a bit of originality!

Responder

Hey there, You’ve done a fantastic job. I will definitely digg it and personally
suggest to my friends. I am sure they will be benefited from this website.

Responder

Great post. I was checking continuously this blog and I’m impressed!
Extremely helpful information particularly the last part 🙂 I care for such info much.

I was looking for this certain info for a very long time.
Thank you and good luck.

Responder

This is very interesting, You’re a very skilled blogger.
I have joined your rss feed and look forward to seeking more of your great post.
Also, I have shared your web site in my social networks!

Responder

Wonderful, what a blog it is! This webpage provides useful facts to us, keep it up.

Responder

Magnificent goods from you, man. I have understand your stuff previous to and you’re just too wonderful.

I really like what you’ve acquired here, certainly like what you are saying and the way in which you say it.
You make it enjoyable and you still care for to keep it smart.
I cant wait to read much more from you. This is really a wonderful site.

Responder

Wow that was strange. I just wrote an really long comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Regardless, just wanted to say superb blog!

Responder

I really like reading through an article that can make
people think. Also, thank you for permitting me
to comment!

Responder

Great work! This is the type of information that are meant to be
shared across the net. Shame on Google for now not positioning this post
higher! Come on over and visit my site . Thank you =)

Responder

Thank you, I’ve recently been searching for
info approximately this topic for a long time and yours is the greatest I have discovered till now.
But, what about the conclusion? Are you sure about the source?

Responder

I’d like to find out more? I’d want to find out more details.

Responder

I have to thank you for the efforts you have put in writing
this site. I am hoping to view the same high-grade blog posts by
you later on as well. In fact, your creative writing abilities has encouraged me to get
my own site now 😉

Responder