May 10, 2000 - Boosting Performance by Avoiding Dots
May 10, 2000 Boosting Performance by Avoiding Dots Tips: May 2000
Yehuda Shiran, Ph.D.
|
var exApp = new ActiveXObject("Excel.Application");
exApp.Workbooks(1).Worksheets(1).Cells(1, 1).Value = "First Cell";
exApp.Workbooks(1).Worksheets(1).Cells(1, 2).Value = "Second Cell";
exApp.Workbooks(1).Worksheets(1).Cells(1, 3).Value = "Third Cell";
exApp.Workbooks(1).Worksheets(1).Cells(1, 4).Value = "Fourth Cell";
exApp.Workbooks(1).Worksheets(1).Cells(1, 5).Value = "Fifth Cell";
The following code shows how to do this in a much more efficient way:
var exApp = new ActiveXObject("Excel.Application");
var exWbook = exApp.Workbooks(1).Worksheets(1);
exWbook.Cells(1, 1).Value = "First Cell";
exWbook.Cells(1, 2).Value = "Second Cell";
exWbook.Cells(1, 3).Value = "Third Cell";
exWbook.Cells(1, 4).Value = "Fourth Cell";
exWbook.Cells(1, 5).Value = "Fifth Cell";