1

I have been using VBscript for writing macros in the excel. But can I write javascript as well for writing the macros?

If yes , then which is much better and why?

1 Answer 1

2

Excel macros can't be written in either VBScript or JavaScript. The language used in Microsoft Office macros is VBA (Visual Basic for Applications), which is similar to VBScript, but not identical.

What you can do with both VBScript and JavaScript is COM automation of Office applications (running from .vbs or .js files respectively):

var xl = new ActiveXObject("Excel.Application");
xl.Visible = true;

var wb = xl.Workbooks.Open("C:\\path\\to\\your.xlsx");
var ws = wb.Sheets(1);

ws.Cells(1,1).Value = "something";

wb.Save();
wb.Close();
xl.Quit();

However, you'll still be using VBA objects and methods that way.

Sign up to request clarification or add additional context in comments.

Comments

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.