Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como Enviar Imagenes en Whatsapp con Excel NUEVA Version 2020 #504

Enviar Imagenes por Whatsapp

Enviar IMAGENES por Whatsapps desde Excel

Muchos me habían preguntado si se podía enviar Imágenes por Whatsapp desde Excel, la respuesta es SI, la macro que se presenta permite envir Fotos o Imagenes por Whatsapp utilizando Excel, esta macro utiliza la API oficial de Whatsapp para poder enviar los mensajes de Whatsapp desde Excel.

Requieres aprender a manejar Excel? 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, 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 FOTOS por Whatsapp desde Excel

Para poder comprender el ejemplo siguiere bajar el archivo adjunto que se puede realizar desde el final de post, ingresando al archivo de Excel se puede observar que existe un botón, presionando el botón de comando emerge un formulario donde se deben rellenar los datos necesarios y presionar el botón de envío de imágenes por Whatapp desde Excel.

En el formulario o userform de Excel  se debe seleccionar el destinatario buscando en el textbox , luego escribir o seleccionar el mensaje y seleccionar la foto o imagen que se requiere enviar por Whatsapp desde Excel. una vez que se tengan los datos mencionados se debe presionar el icono de Whatsapp para que se empiece a enviar el mensaje de Whatsapp desde Excel.

Como funciona el código que envía FOTOS por Whatsapp desde Excel

La macro al presionar el botón para enviar Fotos por Whatsapp desde Excel que está en el formulario inserta en Excel la imagen desde la dirección seleccionada la copia en el portapapeles, manteniendola en memoria hasta su uso, el código que se utiliza es el siguiente:

Set imag = ActiveSheet.Pictures.Insert(direima)
With imag
.Copy
.Delete
End With


telwhatsapp = UserForm1.TextBox8
textwhatsapp = UserForm1.TextBox1
Call EnviaWhatsapp

La macro obtiene el valor de las variable telwhatsapp y textwhatsapp desde los datos del formulario y llama a la macro que envía Whatsapp desde Excel.

Posteriormente se valida el teléfono del contacto y el texto a enviar respectivamente, se controla que se hayan ingresado datos y dichas variables no estén vacías, el código utilizado es:

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

Luego se procede a navegar hasta la API oficial de Whatsapp, con el siguiente código:

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

ActiveWorkbook.FollowHyperlink mylinkwhatsapp

Una vez que se ingresó a la API, se hace que la macro espere unos segundos antes de enviar el siguiente comando, ello es para que se cargue la página con los chats, enviando una pulsación de tecla de Tab, con ello se pasa al siguiente textbox para envío de datos, se espera unos segundos y se pega la imagen Enter a través de Senkey y se envía el mensaje, los código son los siguientes:

Application.Wait (Now + TimeValue(«00:00:08»))
ActiveWindow.Application.SendKeys «{TAB}»
ActiveWindow.Application.SendKeys «(~)»
Application.Wait (Now + TimeValue(«00:00:05»))
ActiveWindow.Application.SendKeys «(^v)»
Application.Wait (Now + TimeValue(«00:00:02»))
ActiveWindow.Application.SendKeys «(~)» ‘énvia enter para enviar mensaje
End Sub



Quizás también interese leer:

Como Eliminar Filas en Base a Color de Fuente 
Como Buscar en Hoja Seleccionada y Llenar Listbox 
Como Buscar Mientras se Escribe y Cargar Listbox con SQL 

Descarga del código del aplicativo para Enviar IMAGENES por Whatsapp desde Excel

El libro de Excel denominado como enviar imágenes por Whatsapp con Excel, se encuentra al final del post desde dicho link se podrá descargar el archivo de ejemplo, 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 a Grupo de Whatsapp

#If VBA7 And Win64 Then
‘Si es de 64 bits
Public Declare PtrSafe Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Public Declare PtrSafe Function FindWindow Lib «USER32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Public Declare PtrSafe Function GetWindowLongPtr Lib «USER32» Alias «GetWindowLongPtrA» (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Public Declare PtrSafe Function SetWindowLongPtr Lib «USER32» Alias «SetWindowLongPtrA» (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
Public Declare PtrSafe Function DrawMenuBar Lib «USER32» (ByVal hwnd As Long) As LongPtr
Public Declare PtrSafe Function RegOpenKeyA Lib «advapire32.dll» (ByVal hKey As LongPtr, ByVal lpSubKey As String, phkResult As LongPtr) As LongPtr
#Else
‘Si es de 32 bits
Public Declare Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function FindWindow Lib «USER32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowLong Lib «USER32» Alias «GetWindowLongA» (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib «USER32» Alias «SetWindowLongA» (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib «USER32» (ByVal hwnd As Long) As Long
Public Declare Function RegOpenKeyA Lib «advapire32.dll» (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
#End If
Public telwhatsapp, textwhatsapp, direima
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:08»))
ActiveWindow.Application.SendKeys «{TAB}»
ActiveWindow.Application.SendKeys «(~)»
Application.Wait (Now + TimeValue(«00:00:05»))
ActiveWindow.Application.SendKeys «(^v)»
Application.Wait (Now + TimeValue(«00:00:02»))
ActiveWindow.Application.SendKeys «(~)» ‘énvia enter para enviar mensaje
End Sub

Código que se Encuentra en el Formulario que Envía Whatsapp a Grupo de Whatsapp

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

Set imag = ActiveSheet.Pictures.Insert(direima)
‘UserForm1.Hide
With imag
.Copy
.Delete
End With
telwhatsapp = UserForm1.TextBox8
textwhatsapp = UserForm1.TextBox1
Call EnviaWhatsapp
End Sub


Private Sub CommandButton2_Click()
direima = Application.GetOpenFilename(«Archivos JPG PNG BMP (*.jpg*;*.png*;*.bmp*), *.jpg*;*.png*;*.bmp*»)
TextBox10 = direima
End Sub


Private Sub ListBox3_Click()
On Error Resume Next
ctlsaltachange = 1
UserForm1.TextBox8 = Empty
fila = UserForm1.ListBox3.ListIndex
UserForm1.TextBox8 = UserForm1.ListBox3.List(fila, 1)
UserForm1.TextBox9 = UserForm1.ListBox3.List(fila, 0) & » » & UserForm1.ListBox3.List(fila, 1) & » » & UserForm1.ListBox3.List(fila, 2)


UserForm1.ListBox3.Visible = False

If TextBox9 = Empty Then
UserForm1.Label2.Visible = True ‘hace visible el label
Else
UserForm1.Label2.Visible = False
End If

If TextBox8 = Empty Then
UserForm1.Label1.Visible = True ‘hace visible el label
Else
UserForm1.Label1.Visible = False
End If

ctlsaltachange = 0
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 TextBox8_Change()
If TextBox8 = Empty Then
UserForm1.Label1.Visible = True ‘hace visible el label
Else
UserForm1.Label1.Visible = False
End If
End Sub


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

‘If ctlsaltachange = 1 Then Exit Sub

If TextBox9 = Empty Then
UserForm1.Label2.Visible = True ‘hace visible el label
Else
UserForm1.Label2.Visible = False
End If

If Len(UserForm1.TextBox9) <= 2 Then
UserForm1.ListBox3.Visible = False
Exit Sub
Else
UserForm1.ListBox3.Visible = True
End If

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;»»»

If Len(UserForm1.TextBox9) > 2 Then
sql = «SELECT * FROM [» & «Hoja1$» & «] WHERE Ucase(» & a.Range(«A1») & «) LIKE Ucase(‘%» & UserForm1.TextBox9 & «%’) ORDER BY Nombre ASC»
Set rs = cn.Execute(sql)

UserForm1.ListBox3.Clear

Set rs = cn.Execute(sql)
If rs.EOF = True Then
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
UserForm1.ListBox3.Visible = False
Exit Sub
Else

UserForm1.ListBox3.Column = 3
UserForm1.ListBox3.ColumnWidths = «100 pt;70 pt;80 pt»

rs.MoveFirst
Do While Not rs.EOF
UserForm1.ListBox3.AddItem rs.Fields(0).Value
UserForm1.ListBox3.List(UserForm1.ListBox3.ListCount – 1, 1) = rs.Fields(1).Value
UserForm1.ListBox3.List(UserForm1.ListBox3.ListCount – 1, 2) = rs.Fields(2).Value
‘ Userform1.ListBox3.List(Userform1.ListBox3.ListCount – 1, 3) = rs.Fields(4).Value
‘ Userform1.ListBox3.List(Userform1.ListBox3.ListCount – 1, 4) = rs.Fields(5).Value
‘ Userform1.ListBox3.List(Userform1.ListBox3.ListCount – 1, 5) = rs.Fields(6).Value
rs.MoveNext
Loop
End If

End If
Set rs = Nothing
cn.Close
Set cn = Nothing

‘Si solo hay un dato coincidente directamente lo busca y carga sus datos, al seleccionarlo se ejecuta el evento click del listbox
If UserForm1.ListBox3.ListCount – 1 = 0 Then
‘El código 1 salta la programacion del evento change del combobox16 porque sino cuando la macro modifica se vuelve a ejecutar y se obtiene resultado no deseado
‘saltacbo16 = 1
‘La macro al seleccionar el item autoaticamente ejecuta la programacion del evento click que es la busqueda del dato y que
‘es lo que interesa en esta programación, por eso no se llama luego al evento listbox_click sino se ejecuta dos veces.
UserForm1.ListBox3.Selected(0) = True
‘Call ListBox3_Click
UserForm1.ListBox3.Visible = False
‘Se hace perder el foco al combobox16, porque sino se ejecuta la codificación del After_Update
‘Userform1.TextBox2.SetFocus
End If
‘salir:
‘Vuelve la variable a estado 0 para que se pueda ejecutar el evento change con otro registro
‘saltacbo16 = 0
Application.ScreenUpdating = True
Application.ScreenUpdating = True

End Sub
Private Sub UserForm_Initialize()
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»
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
504 ❤️Como Enviar Imagenes en ? Whatsapp con Excel NUEVA Version 2020
Article Name
504 ❤️Como Enviar Imagenes en ? Whatsapp con Excel NUEVA Version 2020
Description
Para Enviar Whatsapp desde Excel 1) Se debe seleccionar el destinatario 2) Seleccionar o escribir el texto o mensaje a enviar 3) Elegir la imagen a enviar 4) Enviar el Whatsapp desde Excel presionando el botón
macrosenexcel.com

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 owner of JustCBD Store company (justcbdstore.com) and I am currently planning to grow my wholesale side of business. I really hope that someone at targetdomain give me some advice . I considered that the very best way to accomplish this would be to connect to vape shops and cbd retailers. I was hoping if someone could recommend a qualified web site where I can purchase CBD Shops B2B Leads I am already examining creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not exactly sure which one would be the very best selection and would appreciate any advice on this. Or would it be easier for me to scrape my own leads? Ideas?

Responder

Управляющим лицам нужно знать законодательство изменилось субсидиарная ответственность без последствий для участников

Responder

Good day! I simply wish to offer you a huge thumbs up for your excellent info you’ve got here on this post. I’ll be coming back to your website for more soon.

Responder

When I originally left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and now every time a comment is added I get 4 emails with the exact same comment. There has to be a means you can remove me from that service? Cheers!

Responder

Pretty! This was an incredibly wonderful post. Thanks for providing this info.

Responder

Spot on with this write-up, I seriously believe that this web site needs far more attention. I’ll probably be returning to read through more, thanks for the info!

Responder

Howdy! This post couldn’t be written much better! Looking at this post reminds me of my previous roommate! He always kept preaching about this. I most certainly will send this article to him. Pretty sure he’s going to have a very good read. Many thanks for sharing!

Responder

I really love your website.. Very nice colors & theme. Did you develop this website yourself? Please reply back as I’m looking to create my very own website and would love to learn where you got this from or just what the theme is named. Many thanks!

Responder

Hi, I do believe this is a great blog. I stumbledupon it 😉 I will revisit yet again since I book-marked it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

Responder

I absolutely love your website.. Pleasant colors & theme. Did you build this web site yourself? Please reply back as I’m hoping to create my own site and would like to know where you got this from or exactly what the theme is named. Kudos!

Responder

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

Responder

That is a really good tip especially to those fresh to the blogosphere. Short but very precise info… Thanks for sharing this one. A must read post!

Responder

I absolutely love your blog.. Great colors & theme. Did you create this amazing site yourself? Please reply back as I’m trying to create my very own site and want to learn where you got this from or exactly what the theme is named. Kudos!

Responder

I absolutely love your site.. Excellent colors & theme. Did you develop this web site yourself? Please reply back as I’m attempting to create my own blog and would like to find out where you got this from or what the theme is named. Kudos!

Responder

An impressive share! I have just forwarded this onto a coworker who had been conducting a little research on this. And he actually ordered me lunch because I discovered it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanx for spending the time to discuss this subject here on your internet site.

Responder

I couldn’t resist commenting. Well written!

Responder

It’s difficult to find knowledgeable people for this topic, but you sound like you know what you’re talking about! Thanks

Responder

Saved as a favorite, I really like your web site!

Responder

You are so awesome! I don’t believe I have read through anything like that before. So nice to discover someone with a few original thoughts on this topic. Really.. many thanks for starting this up. This site is one thing that is required on the web, someone with a little originality!

Responder

Very good post. I certainly appreciate this site. Continue the good work!

Responder

Oh my goodness! Amazing article dude! Thank you so much, However I am experiencing troubles with your RSS. I don’t know why I cannot join it. Is there anybody else having the same RSS issues? Anyone that knows the answer will you kindly respond? Thanx!!

Responder

Great blog you have here.. It’s hard to find quality writing like yours these days. I really appreciate people like you! Take care!!

Responder

Hello there! This article couldn’t be written any better! Reading through this post reminds me of my previous roommate! He always kept talking about this. I am going to forward this post to him. Fairly certain he will have a great read. Thank you for sharing!

Responder

I’m impressed, I must say. Rarely do I encounter a blog that’s both equally educative and interesting, and let me tell you, you’ve hit the nail on the head. The issue is something not enough folks are speaking intelligently about. Now i’m very happy that I came across this in my hunt for something concerning this.

Responder

I’m very pleased to discover this website. I want to to thank you for your time for this particularly wonderful read!! I definitely really liked every bit of it and i also have you saved as a favorite to see new stuff in your blog.

Responder

Great information. Lucky me I came across your blog by chance (stumbleupon). I have bookmarked it for later!

Responder

I’m impressed, I have to admit. Seldom do I come across a blog that’s equally educative and engaging, and without a doubt, you have hit the nail on the head. The issue is something that not enough men and women are speaking intelligently about. Now i’m very happy I found this in my search for something regarding this.

Responder

That is a great tip particularly to those fresh to the blogosphere. Simple but very accurate info… Many thanks for sharing this one. A must read post!

Responder

This website was… how do I say it? Relevant!! Finally I’ve found something that helped me. Many thanks!

Responder

Hey! This is kind of off topic but I need some
guidance from an established blog. Is it tough to set up your own blog?
I’m not very techincal but I can figure things out pretty quick.
I’m thinking about setting up my own but I’m not sure where to begin. Do you have any tips or suggestions?
Cheers

Responder