I have Microsoft Office 2013 installed in a Windows 7 machine. After several searches could not find and example or tutorial that shows how to use standalone JavaScript for scripting Microsoft Office 2013, that is without integrating it in a web page (HTML file) or creating UI components, specifically for modifying contents of MS Word or MS Excel. How can this be accomplished do this?
You can run JavaScript code on Windows without a browser using Windows Script Host. I believe by default .js files are associated with wscript.exe, which runs the script without a console. You can also run them with access to a console via cscript.exe, e.g.:
cscript.exe /nologo yourfile.js
You can then get access to Office via ActiveXObject, e.g.:
var excel = new ActiveXObject("Excel.Application");
That gives you access to the COM API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With