Whatsapp automated message macro

zakizelani

New Member
Joined
Mar 3, 2016
Messages
25
Hi, does anybody know how can i send mass message via whatsapp by using macro in excel.

I need a code that tell excel to open this link
(https://wa.me/ + country code + the contact number) and send a pre text message to the person that i have in another column
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I don't use whatsapp so cannot test.

Try editing the phone and text below and hopefully we can go from there:

VBA Code:
Sub wpp()
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application") 'Create object IE
    IE.navigate "whatsapp://send?phone=5511912341234&text=something" 'Send message "something" to this phone (Brazil)
    Application.Wait Now() + TimeSerial(0, 0, 3) 'ok just one wait and sendkeys :v
    SendKeys "~"
    'IE.Quit 'The navigate already kills the IE
    Set IE = Nothing 'Clear the object
End Sub
 
Upvote 0
I tested the code and it works.
However, I would like a code to send messages written in one column to phone numbers written in another column.
 
Upvote 0
Without any clear details, something like:

VBA Code:
Sub wpp()

Dim IE As Object
Dim mymesssage As String
Dim mynumber As String
Dim rownum As Long
    
rownum = 2
    
Do Until Cells(rownum, 1) = ""
    Cells(rownum, 1) = mymessage
    Cells(rownum, 2) = mynumber
    
    Set IE = CreateObject("InternetExplorer.Application")
    IE.navigate "whatsapp://send?phone=" & mynumber & "&text=" & mymessage
    Application.Wait Now() + TimeSerial(0, 0, 3)
    SendKeys "~"
    Set IE = Nothing
    
    rownum = rownum + 1
Loop
    
End Sub
 
Upvote 0
Without any clear details, something like:

VBA Code:
Sub wpp()

Dim IE As Object
Dim mymesssage As String
Dim mynumber As String
Dim rownum As Long
   
rownum = 2
   
Do Until Cells(rownum, 1) = ""
    Cells(rownum, 1) = mymessage
    Cells(rownum, 2) = mynumber
   
    Set IE = CreateObject("InternetExplorer.Application")
    IE.navigate "whatsapp://send?phone=" & mynumber & "&text=" & mymessage
    Application.Wait Now() + TimeSerial(0, 0, 3)
    SendKeys "~"
    Set IE = Nothing
   
    rownum = rownum + 1
Loop
   
End Sub
Thanks, but your code doesn't work for me. I do not know why.
What I want is for the messages written in column C to be sent via whatsapp to the phone numbers in column A

COL A COL B COL C
00407XXXXXXXX NAME1 Message 1
00407YYYYYYYY NAME2 Message 2
00407ZZZZZZZZ NAME3 Message3
 
Upvote 0
Try

VBA Code:
Sub wpp()

Dim IE As Object
Dim mymesssage As String
Dim mynumber As String
Dim rownum As Long
   
rownum = 2
   
Do Until Cells(rownum, 1) = ""
    Cells(rownum, 3) = mymessage
    Cells(rownum, 1) = mynumber
   
    Set IE = CreateObject("InternetExplorer.Application")
    IE.navigate "whatsapp://send?phone=" & mynumber & "&text=" & mymessage
    Application.Wait Now() + TimeSerial(0, 0, 3)
    SendKeys "~"
    Set IE = Nothing
   
    rownum = rownum + 1
Loop
   
End Sub
 
Upvote 0
I found it to work when I replace:

SendKeys "~"

with

SendKeys "{Enter}"
 
Upvote 0

Forum statistics

Threads
1,223,969
Messages
6,175,682
Members
452,667
Latest member
vanessavalentino83

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