Advertisement
jdelano

Untitled

Apr 14th, 2025
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. Sub Send_Image_To_WhatsApp()
  2.  
  3. Dim whatsapp_number As String
  4. Dim sh As Worksheet
  5. Dim tsh As Worksheet
  6. Dim i As Integer
  7.  
  8. Set sh = ThisWorkbook.Sheets("Data")
  9. Set tsh = ThisWorkbook.Sheets("Template")
  10.  
  11. For i = 4 To sh.Range("A" & Application.Rows.Count).End(xlUp).Row
  12. If sh.Range("AJ" & i).Value <> "Yes" Then 'check skip
  13. whatsapp_number = sh.Range("AI" & i).Value
  14.  
  15. ' Filling the template
  16. tsh.Range("I10").Value = sh.Range("A" & i).Value
  17. tsh.Range("F9").Value = sh.Range("B" & i).Value
  18. tsh.Range("B9").Value = sh.Range("C" & i).Value
  19. tsh.Range("F10").Value = sh.Range("D" & i).Value
  20. tsh.Range("H12").Value = sh.Range("E" & i).Value
  21. tsh.Range("E12").Value = sh.Range("F" & i).Value
  22. tsh.Range("B12").Value = sh.Range("G" & i).Value
  23. tsh.Range("H13").Value = sh.Range("H" & i).Value
  24. tsh.Range("E13").Value = sh.Range("I" & i).Value
  25. tsh.Range("B13").Value = sh.Range("J" & i).Value
  26. tsh.Range("H14").Value = sh.Range("K" & i).Value
  27. tsh.Range("E14").Value = sh.Range("L" & i).Value
  28. tsh.Range("B14").Value = sh.Range("M" & i).Value
  29. tsh.Range("H15").Value = sh.Range("N" & i).Value
  30. tsh.Range("E15").Value = sh.Range("O" & i).Value
  31. tsh.Range("B15").Value = sh.Range("P" & i).Value
  32. tsh.Range("H16").Value = sh.Range("Q" & i).Value
  33. tsh.Range("E16").Value = sh.Range("R" & i).Value
  34. tsh.Range("B16").Value = sh.Range("S" & i).Value
  35. tsh.Range("H17").Value = sh.Range("T" & i).Value
  36. tsh.Range("E17").Value = sh.Range("U" & i).Value
  37. tsh.Range("B17").Value = sh.Range("V" & i).Value
  38. tsh.Range("H19").Value = sh.Range("W" & i).Value
  39. tsh.Range("E19").Value = sh.Range("X" & i).Value
  40. tsh.Range("B19").Value = sh.Range("Y" & i).Value
  41. tsh.Range("H20").Value = sh.Range("Z" & i).Value
  42. tsh.Range("E20").Value = sh.Range("AA" & i).Value
  43. tsh.Range("B20").Value = sh.Range("AB" & i).Value
  44. tsh.Range("H21").Value = sh.Range("AC" & i).Value
  45. tsh.Range("E21").Value = sh.Range("AD" & i).Value
  46. tsh.Range("B21").Value = sh.Range("AE" & i).Value
  47. tsh.Range("G24").Value = sh.Range("AF" & i).Value
  48. tsh.Range("I18").Value = sh.Range("AG" & i).Value
  49.  
  50. ThisWorkbook.FollowHyperlink "https://web.whatsapp.com/send?phone=%2B" & whatsapp_number & "&text=&app_absent=1&send=1"
  51. Application.Wait (Now() + TimeValue("00:00:03"))
  52.  
  53. tsh.Range("B2:J28").CopyPicture , xlBitmap
  54. Application.Wait (Now() + TimeValue("00:00:02"))
  55.  
  56. VBA.SendKeys ("^v")
  57. Application.Wait (Now() + TimeValue("00:00:02"))
  58.  
  59. VBA.SendKeys "~", True
  60. Application.Wait (Now() + TimeValue("00:00:02"))
  61. End If
  62. Next i
  63.  
  64. tsh.Range("B2:J26").ClearContents
  65.  
  66. MsgBox "Process Completed", vbInformation
  67. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement