title: 64 bit Excel VBA to call a JavaScript function
body: <p>I need to use a VBA ScriptControl object to call a JavaScript function , but it gave me a "Class Not Registered" error. 
  I have added Microsoft Script Control 1.0 from Tools->References
  I need to call JavaScript to get a JSON object from this <a href="https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&amp;from_currency=USD&amp;to_currency=JPY&amp;apikey=demo" rel="nofollow noreferrer">Rest API</a> to calculate values in an Excel Macro. </p>
  
  <p><a href="https://stackoverflow.com/questions/9725882/getting-scriptcontrol-to-work-with-excel-2010-x64">This post</a> told me that ScriptControl is  for use  in 32 bit only. I am using 64 bit Excel. 
  I also tried using the method mentioned in this <a href="https://tablacus.github.io/scriptcontrol_en.html" rel="nofollow noreferrer">link</a> but it didn't work since VBA doesn't recognise the ActiveXObject</p>
  
  <p>My Excel VBA code to call a simple JS function: </p>
  
  <pre><code>Private Sub CommandButton1_Click()
      Dim jsObj As MSScriptControl.ScriptControl, result As Integer
      Set jsObj = CreateObject("MSScriptControl.ScriptControl")
      jsObj.Language = "JScript"
      With jsObj
          .AddCode ("function prod1(a,b){return a*b;}")
          result = .Run("prod1", 2, 3)
      End With
      MsgBox result
  End Sub
  </code></pre>
  
  <p>I am getting a class not registered error for the line Set jsObj = CreateObject("MSScriptControl.ScriptControl")
  Is there an alternate way to call a JavaScript function from VBA? Or am I missing something?</p>