Allumer une position

Prérequis:

  1. Activer le mode développeur dans Excel
  2. Créer une Macro
  3. Déposer le code ci-dessous
Private Sub Button_Click()

Position = Application.ActiveSheet.Cells(ActiveCell.Row, ActiveCell.Column).Value

ServerAddress = "xx.pblsrv.com"
User = "admin"
Password = "yourpassword"

Url = "http://" & ServerAddress & ":1337/PBL_SwitchOnPosition/.json?Position=" & Position

Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.Open "POST", Url, False, User, Password
objHTTP.send ("{""key"":null,""attachments"":null}")

MsgBox objHTTP.responseText

End Sub

Eteindre une position

Private Sub Button_Click()

Position = Application.ActiveSheet.Cells(ActiveCell.Row, ActiveCell.Column).Value

ServerAddress = "xx.pblsrv.com"
User = "admin"
Password = "yourpassword"

Url = "http://" & ServerAddress & ":1337/PBL_SwitchOffPosition/.json?Position=" & Position

Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.Open "POST", Url, False, User, Password
objHTTP.send ("{""key"":null,""attachments"":null}")

MsgBox objHTTP.responseText

End Sub