Running this code by clicking on a checkbox (1 Viewer)

Sam Summers

Registered User.
Local time
Today, 16:43
Joined
Sep 17, 2001
Messages
939
Hey guys,
I think i am nearly there with this but not quite sure about how to run this:-

Code:
Sub Main_Routine()
  Dim groupAdmin As String = "12025550108"  ''' TODO: Specify the WhatsApp number of the group creator, including the country code
  Dim groupName As String = "Happy Club"  ''' TODO: Specify the name of the group
  Dim message As String = "Let's party tonight!" ''' TODO: Specify the content of your message
 
  WhatsAppMessage_SendGroup groupAdmin, groupName, message
End Sub


Sub WhatsAppMessage_SendGroup(ByRef strGroupAdmin As String, ByRef strGroupName As String, ByRef strMessage As String)
  Dim INSTANCE_ID As String, CLIENT_ID As String, CLIENT_SECRET As String, API_URL As String
  Dim strJson As String
  Dim sHTML As String
  Dim oHttp As Object
 
  ''' TODO: Replace the following with your gateway instance ID, Forever Green client ID and secret:
  INSTANCE_ID = "YOUR_INSTANCE_ID_HERE"
  CLIENT_ID = "YOUR_CLIENT_ID_HERE"
  CLIENT_SECRET = "YOUR_CLIENT_SECRET_HERE"
  API_URL = "http://api.whatsmate.net/v3/whatsapp/group/text/message/" & INSTANCE_ID

  strJson = "{""group_admin"": """ & strGroupAdmin & """, ""group_name"": """ & strGroupName & """, ""message"": """ & strMessage & """}"

  Set oHttp = CreateObject("Msxml2.XMLHTTP")
  oHttp.Open "POST", API_URL, False
  oHttp.setRequestHeader "Content-type", "application/json"
  oHttp.setRequestHeader "X-WM-CLIENT-ID", CLIENT_ID
  oHttp.setRequestHeader "X-WM-CLIENT-SECRET", CLIENT_SECRET
  oHttp.Send strJson

  sHTML = oHttp.ResponseText
  MsgBox sHTML
End Sub

I have obviously entered my details correctly so the issue is how to run this from the OnClick Event of my checkbox called "ReceivedDornie"

Many thanks in advance
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 16:43
Joined
Jul 9, 2003
Messages
16,271
I don't really understand? Why a checkbox what is the significance? why not a command button?

I suspect there's more to your question then you have so far revealed.
 

Sam Summers

Registered User.
Local time
Today, 16:43
Joined
Sep 17, 2001
Messages
939
Well i need to send an automatic message when an item is received. So the user simply clicks the checkbox to confirm receipt
 

Users who are viewing this thread

Top Bottom