Send messages through whatsapp

phiero21

Board Regular
Joined
Sep 20, 2007
Messages
136
Hi, I am using the below script to send messages via whatsapp to different numbers. It works perfectly and sends messages in col F to all numbers.

However, I want to modify the script to send 3 messsages to the numbers. The messages are in col F, G & H. Any suggestions please



VBA Code:
Sub Send_Text_To_WhatsApp()

Dim whatsapp_number As String


Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Data")

Dim i As Integer

For i = 4 To sh.Range("A" & Application.Rows.Count).End(xlUp).Row

If sh.Range("J" & i).Value <> "Yes" Then   '' Check Skip

        whatsapp_number = sh.Range("I" & i).Value
    
        ThisWorkbook.FollowHyperlink "https://web.whatsapp.com/send?phone=%2B" & whatsapp_number & "&text=" & _
        sh.Range("F" & i).Value & "&app_absent=1&send=1"
      
        Application.Wait (Now() + TimeValue("00:00:08"))

            VBA.SendKeys "~", True
            
            
            
            Application.Wait (Now() + TimeValue("00:00:01"))
            
             
    End If

Next i

MsgBox "Process Completed", vbInformation

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi, you could try adding another, inner loop, something like this:

VBA Code:
Sub Send_Text_To_WhatsApp()

Dim whatsapp_number As String


Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Data")

Dim i As Long, j As Long

For i = 4 To sh.Range("A" & Application.Rows.Count).End(xlUp).Row

If sh.Range("J" & i).Value <> "Yes" Then   '' Check Skip

        whatsapp_number = sh.Range("I" & i).Value
    
        For j = 0 To 2
    
            ThisWorkbook.FollowHyperlink "https://web.whatsapp.com/send?phone=%2B" & whatsapp_number & "&text=" & _
            sh.Range("F" & i).Offset(, j).Value & "&app_absent=1&send=1"
          
            Application.Wait (Now() + TimeValue("00:00:08"))
    
            VBA.SendKeys "~", True
                
            Application.Wait (Now() + TimeValue("00:00:01"))
            
        Next j
                     
                     
    End If

Next i

MsgBox "Process Completed", vbInformation

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,287
Members
449,094
Latest member
GoToLeep

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