Hallo there,
filling up a big MS Word table with ActiveX -> VBA is sooooo slow.
How could I boost my performance for the following code?
Thank you very much in advanceHTML Code:hdlActiveX = actxserver('Word.Application'); ... hdlActiveX.ActiveDocument.Tables.Add(hdlActiveX.Selection.Range, nbRows, nbCols, 1, 1).Rows.Alignment = 1; ... % create dataCell{nbRows, nbCols} containing the table values row- and columnwise ... nrTable = ... % an integer selecting a table in the MS Word document ... for r = 1:nbRows for c = 1:nbCols % Write data into current cell hdlActiveX.ActiveDocument.Tables.Item(1).Cell(r,c).Range.Text = dataCell{r, c}; % setting a different background color rowwise, if a condtion is met % this is even bigger performance reducer if condition for iCol = 1:nbCols hdlActiveX.ActiveDocument.Tables.Item(nrTable).Cell(r,iCol).Select; hdlActiveX.Selection.Shading.BackgroundPatternColor = color; end end end end


Reply With Quote

