Advertisement
Apuu

MARIA DA CLARO

Oct 15th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public texto, texto2, texto3 As String
  2.  
  3.  
  4.  
  5.     Sub Enviar()
  6.  
  7. Application.ScreenUpdating = False
  8.  
  9. 'não pode fazer clicks ou mudar o foco do mouse nem pressionar teclas
  10. Dim Contato As String
  11.  
  12.     'Plan4.Visible = 1
  13.    Plan4.Select
  14.     Plan4.Range("A2").Select
  15.     Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
  16.     'Plan4.Visible = 2
  17.    Plan1.Select
  18.  
  19.  
  20. OpenInGoogleChromeNewTab "http://web.whatsapp.com"
  21.  
  22.  
  23. End Sub
  24.  
  25. Sub OpenInGoogleChromeNewTab(url As String)
  26.  
  27. pathFireFox = "C:\Program Files\Google\Chrome\Application\chrome.exe"
  28.  
  29. 'para newtab usar esse -new-tab
  30. Shell """" & pathFireFox & """" & " -new-tab " & url, vbHide
  31.  
  32. Fazer (15000)
  33.  
  34. linha = 7
  35. 'Do Until Plan1.Cells(linha, 4) = ""
  36.  
  37. Fazer (10000)
  38.  
  39. If Range("A1").Value > 0 Then
  40. Contato = Plan1.Cells(linha, 4)
  41. Else
  42. Contato = Plan1.Cells(linha, 4)
  43. End If
  44.  
  45.  
  46.  
  47. If Contato = "" Then
  48. MsgBox "Preencha os endereços de contatos!", 64, "Insira pelo menos um Contato"
  49. Exit Sub
  50. End If
  51.  
  52. Fazer (3000)
  53.  Call SendKeys("{TAB}", True)
  54.  Call SendKeys(Contato, True)
  55. Call SendKeys("~", True)
  56.  
  57. Fazer (8000)
  58.  
  59. If Range("A1").Value > 0 Then
  60.  
  61.     Call SendKeys(Range("B4").Value, True)
  62.  
  63. Else
  64.  
  65. For i = 1 To 9
  66.  
  67.     Call SendKeys(Range("B" & i + 6).Value, True)
  68.     SendKeys "+{ENTER}", True
  69.  
  70. Next
  71.  
  72. End If
  73.  
  74. SendKeys "{ENTER}", True
  75. Call SendKeys("~", True)
  76.  
  77. linha = linha + 1
  78.  
  79. 'Loop
  80.  
  81. Fazer (180000)
  82.  
  83. Call SendKeys("%{F4}", True)
  84.  
  85.  
  86. End Sub
  87.  
  88. Function Fazer(ByVal Acao As Double)
  89.  
  90. Application.Wait (Now() + Acao / 24 / 60 / 60 / 1000)
  91.  
  92. 'milliSeconds
  93. End Function
  94.  
  95. Private Sub Atualiza()
  96. '
  97. ' Atualiza Macro
  98. '
  99. ' Atalho do teclado: Ctrl+k
  100.  
  101. Application.ScreenUpdating = False
  102.    
  103.     'Plan4.Visible = 1
  104.    Plan4.Select
  105.     Plan4.Range("A2").Select
  106.     Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
  107.    ' Plan4.Visible = 2
  108.    Plan5.Select
  109.  
  110. MsgBox ("Atualizado com sucesso!!"), vbInformation, "Atenção!'"
  111.  
  112. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement