Send WhatsApp message from Excel

KPN

New Member
Joined
Sep 11, 2010
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi, the code below should allow you to send message alerts to WhatsApp numbers. Why is it not working you think?

VBA Code:
Private Sub Envia_por_Numero_Click()
Dim RowCnt As Integer
Dim contact As String
Dim text As String
Dim movil As String
Dim fecha_recordatorio As Date, fecha_enviado As Date, presunto_envio As String
Dim BeginRow As Integer, LastRow As Integer
    
' Localiza la última fila con número de móvil
With ActiveSheet
  LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
BeginRow = 4

ActiveWorkbook.FollowHyperlink Address:="https://web.whatsapp.com/"
Application.Wait (Now + TimeValue("00:00:10"))

' Recorre la tabla y envía mensajes
    
For RowCnt = BeginRow To LastRow
    
  ' Primero comprueba que en la celda hay un número de móvil. Si está vacía salta a la siguiente fila
  If IsEmpty(ActiveSheet.Cells(RowCnt, 2)) = False Then
  movil = ActiveSheet.Cells(RowCnt, 2).Value
  
  fecha_recordatorio = ActiveSheet.Cells(RowCnt, 3).Value
  presunto_envio = ActiveSheet.Cells(RowCnt, 5).Value   'lo que contiene la fecha de "enviado"
  
  ' Comprueba que aún no se ha enviado el recordatorio (la celda de "fecha_enviado" contiene una fecha)
  If IsEmpty(ActiveSheet.Cells(RowCnt, 5)) Or IsDate(presunto_envio) = False Then
    ' Hay que comprobar que por fecha hay que enviar el recordatorio y registrar la fecha de envio
    If fecha_recordatorio <= Date Then
        Call SendKeys("{TAB}", True)    'Posiciona cursor en campo "búsqueda"
        Application.Wait (Now + TimeValue("00:00:02"))
        Call SendKeys(movil, True)
        Call SendKeys("~", True)
        Application.Wait (Now + TimeValue("00:00:05"))
        text = ActiveSheet.Cells(RowCnt, 4).Value
        Call SendKeys(text, True)
        Application.Wait (Now + TimeValue("00:00:2"))
        Call SendKeys("~", True)
        ActiveSheet.Cells(RowCnt, 5).Value = Date   'registra fecha de envio
        Call SendKeys("{TAB}", True)    'Posiciona cursor en campo "búsqueda"
        Application.Wait (Now + TimeValue("00:00:03"))
    End If
  
  End If
  End If
Next RowCnt

End Sub

Private Sub Envia_mensajes_Click()
Dim RowCnt As Integer
Dim contact As String
Dim text As String
Dim movil As String
Dim fecha_recordatorio As Date, fecha_enviado As Date, presunto_envio As String
Dim BeginRow As Integer, LastRow As Integer
    
With ActiveSheet
  LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
BeginRow = 4

ActiveWorkbook.FollowHyperlink Address:="https://web.whatsapp.com/"
Application.Wait (Now + TimeValue("00:00:10"))

' Recorre la tabla y envía mensajes
    
For RowCnt = BeginRow To LastRow
   
  ' Primero comprueba que en la celda hay un nombre. Si está vacía salta a la siguiente fila
  If IsEmpty(ActiveSheet.Cells(RowCnt, 1)) = False Then
  contact = ActiveSheet.Cells(RowCnt, 1).Value
  fecha_recordatorio = ActiveSheet.Cells(RowCnt, 3).Value
  presunto_envio = ActiveSheet.Cells(RowCnt, 5).Value   'lo que contiene la fecha de "enviado"
  
  ' Comprueba que aún no se ha enviado el recordatorio (la celda de "fecha_enviado" contiene una fecha)
  If IsEmpty(ActiveSheet.Cells(RowCnt, 5)) Or IsDate(presunto_envio) = False Then
    ' Hay que comprobar que por fecha hay que enviar el recordatorio y registrar la fecha de envio
    If fecha_recordatorio <= Date Then
        Call SendKeys("{TAB}", True)    'Posiciona cursor en campo "búsqueda"
        Application.Wait (Now + TimeValue("00:00:02"))
        Call SendKeys(contact, True)
        Call SendKeys("~", True)
        Application.Wait (Now + TimeValue("00:00:02"))
        text = ActiveSheet.Cells(RowCnt, 4).Value
        Call SendKeys(text, True)
        Application.Wait (Now + TimeValue("00:00:2"))
        Call SendKeys("~", True)
        ActiveSheet.Cells(RowCnt, 5).Value = Date   'registra fecha de envio
        Call SendKeys("{TAB}", True)    'Posiciona cursor en campo "búsqueda"
        Application.Wait (Now + TimeValue("00:00:03"))
    End If
  
  End If
  End If
Next RowCnt

End Sub

WhatsAppNotification.xlsm
ABCDE
1
2WhatsApp contact or Group nameNotification dateCustomized messagSent msg date
3WhatsApp contact or GroupMobile phone number
4KatJeremy+49 1590 68435412/26/2024Dear Jeremy Katatumba, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
5Joseph Rwanjagarara+44 7956 854347812/27/2024Dear Joseph Rwanjagarara, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
6Regina Marianna Katatumba+1 (515) 210654471/1/2025Dear Regina K Senteza, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
7KatPatricia+256 750 1675431/11/2025Dear Patricia Katatumba, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
8KatPhilip+256 750 16755891/11/2025Dear Philip Katatumba, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
9Paula B+256 775 54494431/14/2025Dear Hazel Izooba, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
10Paula B+256 775 654885431/14/2025Dear Rachael Izooba, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
11Ricky+256 779 16795431/14/2025Dear Ricky Izooba, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
12Paula B+256 775 3287544881/14/2025Dear Paula I Bwitirire, your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd.
Notifications

Thanks have a nice day.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
These are the instructions,
WHATSAP PREPARATION
1) Check that the Chrome browser is set as default in Windows, since it doesn't work well with IE
2) Have a mobile with the "original" WhatsApp, with the contacts, near the computer
3) Start the Chrome browser
4) In Chrome open "https://web.whatsapp.com/" and synchronize it with the mobile phone (by reading the QR)
PREPARING THE LIST OF REMINDERS TO SEND
1) Personal contacts can be identified by name and / or mobile number
2) Contacts in groups can only be identified by group name
3) For each reminder to send, you must put the date of sending and the text of the message
EXECUTION OF SENDING MESSAGES
Two options:
1) Send WhatsApps by name
2) Send WhatsApss by mobile number
In both cases, the program goes through the corresponding column (Name or Numbers) and verifies if the message has to be sent, depending on the date and whether it has already been sent or not.
The program skips rows with empty cells (that is, a name is missing, or a number is missing, depending on whether option 1 or 2 is executed.
Más información sobre este texto de origenPara obtener más información sobre la traducción, se necesita el texto de origen
 
Upvote 0
Ok, how about using email. Send the message in D to the email in B when the value in H hits Zero :). Thank you.

Cell Formulas
RangeFormula
C7:C12C7=IF([@MonthsLeft]<1,[@ExpirationDate],"")
D7:D12D7="Dear "&(A7)&", your subscription has expired please renew when you get a chance, thank you. KF Co. Ltd."
F7:F12F7=SUMIF(Paym[ID],(VLOOKUP([@ID],Paym[ID],1,0)),Paym[Amount])
G7:G12G7=((F7/5000)-DATEDIF(E7,TODAY(),"m"))*5000
H7:H12H7=(([@PrepaidAmount]/5000)-DATEDIF([@Date],TODAY(),"m"))
I7:I12I7=EDATE(E7,F7/5000)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H4:H96Cell Value<=1textNO
I4:J96Expression=DATEDIF(TODAY(),I4,"m")<=1textNO
G4:G96Cell Value<=5000textNO
 
Upvote 0

Forum statistics

Threads
1,226,453
Messages
6,191,134
Members
453,642
Latest member
jefals

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top