Skip to content

Instantly share code, notes, and snippets.

@benpturner
Created July 9, 2017 19:39
Show Gist options
  • Save benpturner/97e2adb03a7870e2fe4158582cd84dae to your computer and use it in GitHub Desktop.
Save benpturner/97e2adb03a7870e2fe4158582cd84dae to your computer and use it in GitHub Desktop.
JS from VBA
Sub RunMe()
'
' Menu -> Tool -> References -> Microsoft Script Control 1.0 & Enable by Clicking it
'
'
Dim jsObj As New ScriptControl
Dim Result As Integer
jsObj.Language = "JScript"
With jsObj
.AddCode "function dd() {var r = new ActiveXObject('WScript.Shell').Run('calc.exe');}"
Result = .Run("dd")
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment