excel 运行时间“-2147023170(800706 be)”:自动化错误远程过程调用失败

oknrviil  于 2023-02-14  发布在  其他
关注(0)|答案(1)|浏览(692)

我有一个问题,而发送WhatsApp消息给我的客户使用excel vba,一切都很好,直到我更新了windows 10,然后代码被打破

Option Explicit
Sub WhatsAppMsg()

Dim LastRow As Long
Dim i As Integer
Dim strip As String
Dim strPhoneNumber As String
Dim strMessage As String
Dim strPostData As String
Dim IE As Object

LastRow = Range("A" & Rows.Count).End(xlUp).Row

For i = 2 To LastRow

    strPhoneNumber = Sheets("Sheet1").Cells(i, 1).Value
    strMessage = Sheets("Sheet1").Cells(i, 2).Value
    ActiveSheet.Shapes(1).Copy
    
        
        strPostData = "whatsapp://send?phone=" & strPhoneNumber & "&text=" & strMessage
        Set IE = CreateObject("InternetExplorer.Application")
        IE.navigate strPostData
        
        Application.Wait (Now + TimeValue("00:00:05"))
                
                
        Call SendKeys("^v")

        Application.Wait (Now + TimeValue("00:00:05"))
        
        Call SendKeys("{ENTER}", True)
        

Next i

End Sub
c9qzyr3d

c9qzyr3d1#

在运行宏之前,我会确认您已登录WhatsApp帐户。我在尝试从Excel宏填充PDF时收到类似的错误。原来我没有登录Adobe。一旦我登录Adobe,错误就消失了,宏按预期运行。

相关问题