Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como Enviar Whatsapp en Forma Masiva con Excel y Cerrar Pestaña Chrome al Enviar #509

Enviar Whatsapp Masivos con Excel cerrar Chrome

Enviar Masivamente Whatsapps desde Excel y Cerrar Chrome

Anteriormente se mostró una Macro de Excel que responde al requerimiento de Como Enviar Whatsapp en forma MASIVA desde Excel Nueva Versión, esta macro utiliza la API oficial de Whatsapp para poder enviar los mensajes de Whatsapp desde Excel, perso sucede que por cada envío va creando una nueva hoja de Chrome, por ende en este post se muestra como cerrar la ventana de Chrome al enviar Whatsapp masivos con Excel VBA.

Se un experto manejando excel, 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, te lo recomiendo no te arrepentirás.

En el vídeo verás la macro en acción con una explicación más detallada de su codificación y funcionamiento, recomiendo observar para una más fácil comprensión de la macro; suscribe a nuestro canal de You Tube, mira el playlist con  vídeos relacionados donde podrás ver la macro en acción con una explicación en forma visual que ayudará a entender el ejemplo en forma más fácil.

Envío de Whatsapp  a Distintos Contactos a la Vez y Cerrar Ventana Chrome

La macro par Enviar Mensajes de Whatsapp Masivos con Excel, se encuentra el botón con el simbolo de Whatsapp que se muestra el ejecutar el formulario contenido en el ejemplo usado y que se denomina enviar con Excel Varios Mensajes de Whatsapp a la vez y Cerrar Ventana de Chrome.

Se deben seleccionar los contactos en el listbox y ejecutar la macro presionando el botón con el logo de Whatsapp, si se desea saber como funciona el formulario, se puede ver el vídeo y ejemplo respectivo en esta web llamado como enviar Whatsapp con Excel con Buscador de Contacto.

Explicación de la Macro que Permite Enviar Mensajes a varios Contactos de Whatsapp y Cerrar Chrome

Seleccionado los destinatarios de los mensajes de Whatsapp se debe presionar el botón con el logo para ejecutar la macro y enviar de Whatsapp a varios destinatarios a la vez, la misma obtiene el número de teléfono y el mensaje de los textbox del formulario guardando los valores en una variable pública, es decir que se puede usar en cualquier parte del proyecto de VBA.

Primero se valida que el contacto tenga número de teléfono y mensaje a enviar, se hace con la siguiente macro:

If telwhatsapp = Empty Or textwhatsapp = Empty Then
MsgBox («Debe ingresar número de telefono y texto para enviar Whatsapp»), vbCritical, «AVISO»
Exit Sub
End If

En caso que se haya ingresado el número de teléfono y el mensaje se navega hasta la API Oficial de Whatsapp, así:

mylinkwhatsapp = «https://api.whatsapp.com/send?phone=» & telwhatsapp & «&text=» & textwhatsapp
ActiveWorkbook.FollowHyperlink mylinkwhatsapp

Realizamos o enviamos pulsaciones de teclado que consiste en un TAB y Enter, ello nos permite abrir Whatsapp Web que está instalado en nuestra PC, cerrando la ventana de Chrome que se genera, con los siguientes códigos:

Application.Wait (Now + TimeValue(«00:00:10»))
ActiveWindow.Application.SendKeys «{TAB}»
ActiveWindow.Application.SendKeys «(~)»
ActiveWindow.Application.SendKeys «^W»

Para cerrar la ventana de Chrome al Enviar Whatsapp se debe escribir el siguiente código:

ActiveWindow.Application.SendKeys «^W»

El resto de códigos es para enviar el mensaje cuando ya está abierto Whatsapp Web:

Application.Wait (Now + TimeValue(«00:00:05»))
ActiveWindow.Application.SendKeys «(~)»
Application.Wait (Now + TimeValue(«00:00:02»))

Lo mencionado anteriormente se realiza por cada uno de los contactos seleccionados, el resultado es que no queda una ventana de Chrome abierta por cada contacto enviado, sino que es cerrada inmediatamente al enviar el Whatsapp desde Excel.



Quizás también interese leer:

Macro VBA recorre filas, busca y copia datos en base a criterios 
Copia datos, abre otro libro pega datos y lo cierra 
Barra de progreso para una apariencia profesional 

Descarga del código del aplicativo Enviar En Forma Masiva Whatsapp desde Excel

Para descargar el ejemplo se debe hacer click en el link correspondiente que se encuentra al final del post, solicito aportar a sostener la esta web si está dentro de tus posibilidades, desde ya muchas gracias.

Código que se encuentra en el modulo Envío Whatsapp Masivo y Cerrar Chrome

Public telwhatsapp, textwhatsapp

‘*********** by marcrodos **** https://macrosenexcel.com *** https://www.youtube.com/c/programarexcel?sub_confirmation=1 ********

Sub Muestra()
UserForm1.Show
End Sub

Sub EnviaWhatsapp()
‘*********** by marcrodos **** https://macrosenexcel.com *** https://www.youtube.com/c/programarexcel?sub_confirmation=1 ********

If telwhatsapp = Empty Or textwhatsapp = Empty Then
MsgBox («Debe ingresar número de telefono y texto para enviar Whatsapp»), vbCritical, «AVISO»
Exit Sub
End If

mylinkwhatsapp = «https://api.whatsapp.com/send?phone=» & telwhatsapp & «&text=» & textwhatsapp
ActiveWorkbook.FollowHyperlink mylinkwhatsapp

Application.Wait (Now + TimeValue(«00:00:10»))
ActiveWindow.Application.SendKeys «{TAB}»
ActiveWindow.Application.SendKeys «(~)»
ActiveWindow.Application.SendKeys «^W»
Application.Wait (Now + TimeValue(«00:00:05»))
ActiveWindow.Application.SendKeys «(~)»
Application.Wait (Now + TimeValue(«00:00:02»))

End Sub

Código que se Encuentra en el Formulario que Envía Whatsapp a Varios Destinatarios a la Vez

Private Sub CommandButton1_Click()
‘*********** by marcrodos **** https://programarexcel.com *** https://www.youtube.com/c/programarexcel?sub_confirmation=1 ************************************

Dim Num As New Collection, dato, conta As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
‘Crea una colección de datos del listbox
Set aa = UserForm1.ListBox1
For x = 0 To aa.ListCount – 1
If aa.Selected(x) = True Then
Num.Add aa.List(x, 1)
End If
Next x
conta = 0
For Each dato In Num
conta = conta + 1
telwhatsapp = dato
textwhatsapp = UserForm1.TextBox1
Call EnviaWhatsapp
Next dato
MsgBox («Se envió Whatsapp a » & conta & » contactos»), vbInformation, «REPORTE»
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Private Sub CommandButton2_Click()
Set a = UserForm1.ListBox1
For x = 1 To a.ListCount – 1
If a.Selected(x) = True Then
a.Selected(x) = False
GoTo sal:
End If
If a.Selected(x) = False Then a.Selected(x) = True
sal:
Next x
End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub TextBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Clear
UserForm1.TextBox1 = TextBox2
End Sub
Private Sub TextBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Clear
UserForm1.TextBox1 = TextBox3
End Sub

Private Sub TextBox4_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Clear
TextBox1 = TextBox4
End Sub

Private Sub TextBox5_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Clear
UserForm1.TextBox1 = «Expte: » & UserForm1.TextBox2 & » Caratula » & UserForm1.TextBox3
TextBox1 = TextBox5
End Sub

Private Sub TextBox6_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Clear
UserForm1.TextBox1 = «Expte: » & UserForm1.TextBox2 & » Caratula » & UserForm1.TextBox3
TextBox1 = TextBox6
End Sub

Private Sub TextBox7_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Clear
UserForm1.TextBox1 = «Expte: » & UserForm1.TextBox2 & » Caratula » & UserForm1.TextBox3
TextBox1 = TextBox7
End Sub

Private Sub UserForm_Initialize()
Dim cn As ADODB.Connection, rs As ADODB.Recordset, sql As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next

ExpteWhatsapp = «SUSCRIBE https://www.youtube.com/c/programarexcel?sub_confirmation=1»
UserForm1.TextBox1 = ExpteWhatsapp
UserForm1.TextBox2 = «Estimado recuerda » & ExpteWhatsapp & » activa la campanita y YouTube te avisara cuando se suba nuevo contenido «
UserForm1.TextBox3 = «Automatiza tus Libros Excel, tutoriales semanales, recuerda » & ExpteWhatsapp & » todas las semanas ideas sobre como automatizar tus libros Excel «
UserForm1.TextBox4 = «Mis datos son:» & Chr(13) & » https://www.youtube.com/c/programarexcel?sub_confirmation=1 » & Chr(13) & » comenta, dale LIKE si te fue útil»
UserForm1.TextBox5 = «Recuerda darle LIKE Y COMENTAR SI FUE UTIL: » & Chr(13) & «RECUERDA » & ExpteWhatsapp
UserForm1.TextBox6 = «Su próxima factura de ProgramarExcel.com vence el: » & Chr(13) & «14/06/2020 «
UserForm1.TextBox7 = «https://programarexcel.com Descarga cientos de ejemplos de Macros de Excel GRATIS, aporta al canal si puedes, sino con like, comentario y suscripción es suficiente»

UserForm1.ListBox1.ColumnCount = 2
UserForm1.ListBox1.ColumnWidths = «80 pt; 60 pt»

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set a = Sheets(«Hoja1»)

cn.Open «Provider=Microsoft.ACE.OLEDB.12.0;» & «Data Source=» & ThisWorkbook.FullName & «;Extended Properties=»»Excel 12.0;HDR=Yes;»»»
sql = «SELECT * FROM [» & «Hoja1$A1:C65000» & «]»

Set rs = cn.Execute(sql)
If rs.EOF = True Then
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Exit Sub
Else
UserForm1.ListBox1 = Clear
‘Adiciona un item al listbox reservado para la cabecera
UserForm1.ListBox1.AddItem

rs.MoveFirst
Do While Not rs.EOF
UserForm1.ListBox1.AddItem rs.Fields(0).Value
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 1) = rs.Fields(1).Value
rs.MoveNext
Loop

‘Carga los datos de la cabecera en listbox
For ii = 0 To rs.Fields.Count – 1
UserForm1.ListBox1.List(0, ii) = rs.Fields(ii).Name
Next ii

‘Selecciona todos los items
catreg = UserForm1.ListBox1.ListCount – 1
For x = 1 To UserForm1.ListBox1.ListCount – 1
UserForm1.ListBox1.Selected(x) = True
Next x
End If
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.

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

Donate:
Cuenta Paypal: https://paypal.me/programarexcel
Cuenta Bitcoin: 1KBGGb8fyDzyR3X1Rie6m7VguzaAfngNbd
Cuenta Ether: 0x41Bbd24556914C83a31217eBb3BC49789b66e407

Summary
Author Rating
1star1star1star1star1star
Aggregate Rating
no rating based on 0 votes

Entradas relacionadas

Deja un comentario

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

Comentarios (30)

I’m the business owner of JustCBD Store company (justcbdstore.com) and I’m presently aiming to develop my wholesale side of company. I really hope that anybody at targetdomain share some guidance 🙂 I thought that the most ideal way to do this would be to reach out to vape companies and cbd retailers. I was really hoping if anybody at all could recommend a qualified website where I can purchase Vape Shop B2B Data List I am already taking a look at creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not exactly sure which one would be the most ideal selection and would appreciate any support on this. Or would it be easier for me to scrape my own leads? Ideas?

Responder

Быстрый результат. ликвидация ООО или смежная процедура банкротство ооо с долгами

Responder

A motivating discussion is definitely worth comment. There’s no doubt that that you ought to publish more on this topic, it might not be a taboo subject but typically folks don’t discuss these subjects. To the next! Many thanks!!

Responder

I’d like to thank you for the efforts you have put in writing this blog. I am hoping to view the same high-grade blog posts from you in the future as well. In fact, your creative writing abilities has motivated me to get my own, personal blog now 😉

Responder

I enjoy looking through an article that can make men and women think. Also, thank you for allowing for me to comment!

Responder

This is the right site for everyone who wants to understand this topic. You understand a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a fresh spin on a subject that’s been written about for years. Wonderful stuff, just great!

Responder

You made some really good points there. I checked on the web to find out more about the issue and found most individuals will go along with your views on this web site.

Responder

Everything is very open with a very clear clarification of the challenges. It was really informative. Your website is very helpful. Many thanks for sharing!

Responder

Oh my goodness! Impressive article dude! Many thanks, However I am going through problems with your RSS. I don’t know why I am unable to subscribe to it. Is there anybody else having identical RSS issues? Anyone that knows the answer will you kindly respond? Thanks!!

Responder

An interesting discussion is worth comment. I do believe that you ought to publish more about this subject, it may not be a taboo matter but typically folks don’t talk about such subjects. To the next! All the best!!

Responder

I love it when people come together and share views. Great site, continue the good work!

Responder

When I initially left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I receive 4 emails with the same comment. There has to be an easy method you are able to remove me from that service? Thanks a lot!

Responder

After going over a handful of the blog posts on your web site, I seriously appreciate your technique of writing a blog. I book-marked it to my bookmark site list and will be checking back soon. Take a look at my website too and let me know what you think.

Responder

You are so awesome! I do not suppose I have read anything like this before. So good to find somebody with a few genuine thoughts on this subject. Really.. thanks for starting this up. This site is something that’s needed on the internet, someone with a little originality!

Responder

It’s hard to find well-informed people in this particular subject, however, you sound like you know what you’re talking about! Thanks

Responder

I’d like to thank you for the efforts you’ve put in penning this website. I’m hoping to see the same high-grade blog posts by you in the future as well. In truth, your creative writing abilities has motivated me to get my own site now 😉

Responder

Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I may come back yet again since I book marked it. Money and freedom is the greatest way to change, may you be rich and continue to help others.

Responder

This website was… how do you say it? Relevant!! Finally I’ve found something which helped me. Cheers!

Responder

May I simply just say what a comfort to find somebody that genuinely understands what they’re discussing on the internet. You actually know how to bring an issue to light and make it important. A lot more people ought to check this out and understand this side of your story. I was surprised that you’re not more popular since you most certainly possess the gift.

Responder

bookmarked!!, I love your web site!

Responder

Having read this I thought it was very enlightening. I appreciate you spending some time and effort to put this information together. I once again find myself personally spending a lot of time both reading and leaving comments. But so what, it was still worthwhile!

Responder

I was excited to uncover this web site. I need to to thank you for ones time for this particularly fantastic read!! I definitely liked every little bit of it and I have you book marked to check out new things on your web site.

Responder

Hi, I do think this is a great website. I stumbledupon it 😉 I will return yet again since I bookmarked it. Money and freedom is the best way to change, may you be rich and continue to help other people.

Responder

You’ve made some decent points there. I looked on the internet to learn more about the issue and found most individuals will go along with your views on this website.

Responder

Hi, There’s no doubt that your website could possibly be having web browser compatibility issues. When I look at your site in Safari, it looks fine but when opening in IE, it has some overlapping issues. I just wanted to give you a quick heads up! Apart from that, wonderful website!

Responder

Hi! I just wish to give you a huge thumbs up for the excellent information you have here on this post. I’ll be returning to your website for more soon.

Responder

I could not resist commenting. Perfectly written!

Responder

After looking over a handful of the blog articles on your site, I honestly like your technique of writing a blog. I book marked it to my bookmark site list and will be checking back in the near future. Please visit my website too and let me know what you think.

Responder

The very next time I read a blog, I hope that it doesn’t fail me just as much as this one. I mean, I know it was my choice to read, however I really thought you would have something helpful to say. All I hear is a bunch of moaning about something that you can fix if you were not too busy seeking attention.

Responder

naturally like your web site but you have to test the spelling on quite
a few of your posts. Several of them are rife with spelling issues and I to find
it very troublesome to tell the reality on the other hand I’ll definitely come again again. adreamoftrains
web hosting companies

Responder