MS Excel to WhatsApp Bulk Message in single Click
Download VBA Note Pad File - Click here
Download Excel Practice File - Click here
Copy Code here
Option Explicit
Sub wamsg()
Dim PhoneNum As String, PicPath As String
Dim MsgText As String
Dim LastRow As Long
Dim i As Integer
Dim condition As String
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
With Sheet1
PhoneNum = .Cells(i, 1).Value
MsgText = .Cells(i, 2).Value
condition = .Cells(i, 3).Value
PicPath = .Cells(i, 4).Value
AppActivate "WhatsApp"
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "^f", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys PhoneNum, True
Application.Wait (Now + TimeValue("00:00:02"))
SendKeys "{Tab}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{Enter}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys MsgText, True
Application.Wait (Now + TimeValue("00:00:10"))
'===========================
'shift tab, enter, enter, path, enter
SendKeys "+{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{Enter}", True
Application.Wait (Now + TimeValue("00:00:01"))
' for images and videos
If condition = "Photo/Video" Then
SendKeys "{Enter}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys PicPath, True
'increase the time in the below line according to the size of file and speed of internet.
Application.Wait (Now + TimeValue("00:00:02"))
SendKeys "{Enter}", True
Application.Wait (Now + TimeValue("00:00:05"))
'for any type of documents (pdf,word,excel etc.)
ElseIf condition = "Document" Then
SendKeys "{Down}", True
SendKeys "{Down}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{Enter}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys PicPath, True
Application.Wait (Now + TimeValue("00:00:02"))
SendKeys "{Enter}", True
Application.Wait (Now + TimeValue("00:00:05"))
End If
'===========================
SendKeys "{Enter}", True
End With
Next i
End Sub
Download VBA Note Pad File - Click here
Download Excel Practice File - Click here
Post a Comment