Sending an image in whatsapp web using VBA

Viewed 3538

Does someone know how to add a picture in an whatsapp web conversation using VBA? Preferably not as an attachment, but directly in the message.

I've reached a point where the code gets me to open the whatsapp web url, finds the contact to which I want to send the message and places the cursor in the message box, but I couldn't find out yet how to paste the image i've copied or even how to attach a picture inside my machine.

As the image I want to paste and send is a print of some of the worksheet's cells, when I write the code as to make it run "ctrl v" it pastes as a text, not as an image as I want.

My code so far:

Sub Send_whats()

Sheets("Current summary").Select

Dim text As String
Dim contact As String

text = "Hi! Here goes a summary of your order"
contact = Cells(6, 3)

If contact = "" Then
MsgBox "Attention, contact is blank!"
Exit Sub
End If

Range("A1:H26").Copy

ActiveWorkbook.FollowHyperlink Address:="https://web.whatsapp.com/"
Application.Wait (Now + TimeValue("0:00:07"))
Call SendKeys("{TAB}", True)
Application.Wait (Now + TimeValue("0:00:05"))
Call SendKeys(contact, True)
Application.Wait (Now + TimeValue("0:00:03"))
Call SendKeys("{TAB}", True)
Application.Wait (Now + TimeValue("0:00:02"))
Call SendKeys("{TAB}", True)
Application.Wait (Now + TimeValue("0:00:02"))
Call SendKeys("{TAB}", True)
Application.Wait (Now + TimeValue("0:00:03"))

Call SendKeys("^(V)", True) 'here is where it goes wrong!

Application.Wait (Now + TimeValue("0:00:03"))
Call SendKeys(text, True)
Application.Wait (Now + TimeValue("0:00:03"))
Call SendKeys("Enter", True)

End Sub

I appreciate any help! Thanks!

0 Answers
Related