首页 > 解决方案 > 使用 VBA 在whatsapp web 中发送图像

问题描述

有人知道如何使用 VBA 在 whatsapp 网络对话中添加图片吗?最好不要作为附件,而是直接在邮件中。

我已经达到了代码让我打开whatsapp web url,找到我想向其发送消息并将光标放在消息框中的联系人的地步,但我还不知道如何粘贴我复制的图像,甚至如何在我的机器中附加图片。

由于我要粘贴和发送的图像是一些工作表单元格的打印,所以当我编写代码以使其运行“ctrl v”时,它会粘贴为文本,而不是我想要的图像。

到目前为止我的代码:

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

我很感激任何帮助!谢谢!

标签: vbawhatsappsendmessage

解决方案


推荐阅读