Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Created February 18, 2016 20:59
Show Gist options
  • Save ScottDeLuzio/b81dfe37d11d3e3273c7 to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/b81dfe37d11d3e3273c7 to your computer and use it in GitHub Desktop.
Software Licensing for Excel Add-In Deactivate License
Sub httpRequestDeactivate()
'Use to deactivate license. Mostly the same as httpRequestActivate but without the check for if the max number of activations has been reached.
Dim oRequest As Object
Const cUrl As String = "https://yoursite.com/?edd_action=deactivate_license&item_name=Name of the Download Product&license="
URL = cUrl & ThisWorkbook.Worksheets("Sheet1").Range("A1").Value
Set oRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
oRequest.Open "GET", URL
oRequest.Send
ThisWorkbook.Worksheets("Sheet1").Range("A2:A4").ClearContents
ThisWorkbook.Worksheets("Sheet1").Range("A2").Value = oRequest.ResponseText
ThisWorkbook.Worksheets("Sheet1").Range("A3").Formula = "=IF(MID($A$2,FIND(""license"",$A$2,1)+10,8)=""inactive"",""inactive"",IF(MID($A$2,FIND(""license"",$A$2,1)+10,5)=""valid"",""valid"",IF(MID($A$2,FIND(""license"",$A$2,1)+10,7)=""invalid"",""invalid"","""")))"
ThisWorkbook.Worksheets("Sheet1").Range("A4").Formula = "=MID($A$2,FIND(""activations_left"",$A$2,1)+18,1)"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment