Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub sendmessages()
n = Sheet1.Cells(Rows.Count, 1).End(xlUp).row - 2
For i = 0 To n
If Cells(i + 2, 1).Value <> "" Then
Set ws2 = CreateObject("wscript.shell")
ws2.AppActivate "微信"
ws2.SendKeys "^%w"
Set ws2 = Nothing
Name = Cells(2 + i, 1).Value
Msg = Cells(2 + i, 2)