1

I want to pass paramaters from VBA to a JavaScript function and then return the result back to the VBA script. At first my JavaScript Function could look like this:

function myFunction(p1, p2) {
  return p1 * p2;   
}

My question is, if there is any command in VBA to solve this problem.

For the final setup, I want to use Node.js with Selenium to get some Information and send it back to VBA.

I know there are a lot of threads with similar question but I just dont get smart out of them. Many people use "execScript method". Can this be applied to my problem?

Thanks for your help.

4
  • Where is the JS function? - in a string/file, or in a webbrowser control ... Commented Aug 17, 2020 at 14:55
  • The function is in a file. Commented Aug 18, 2020 at 5:14
  • 1
    Assuming Windows you can use an instance of the ScriptControl as shown here: stackoverflow.com/questions/62166109/… Commented Aug 18, 2020 at 5:37
  • 1
    ...and read the file content using (eg) built-in file functions or maybe Scrripting.FileSystemObject Commented Aug 18, 2020 at 5:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.