Word :-)
|
Maximising the performance of Word tables
Article contributed by Dave Rado
| |
| |
To return to top, press Ctrl+Home, or use Alt + Left Arrow to |
As a user
1. | Working in Normal view when you can helps, especially if you turn off “Background repagination” (Tools + Options + General). |
2. | If using Word 2000 and above, select Table | Table Properties | Options, |
3. | Don't create a single row containing a large amount of text.
Apart from anything else, laying out table So
|
4. | Break long tables up (use several smaller tables rather than
... split your
|
5. | Avoid using merged cells as much as possible: wherever you |
6. | In Word 2000 and above, use “text-wrapped” tables |
7. | In Word 2000 and above, if your tables contain graphics, |
In code
1. | If using Word 2000 and above, turn off “Automatically resize to fit Selection.Tables(1).AllowAutoFit = False
| |||||||||||||
2. | 2–7 above apply to tables created with code as well. In the case of Dim ViewType As Unfortunately, even with ScreenUpdating switched off, the screen flickers | |||||||||||||
3. | If you are putting data into a Word table using code (e.g. Sub GetDataIntoTable() If some cells in your table need to contain more than one paragraph (or to | |||||||||||||
4. | If for some reason you can't insert your text in Set oTable = ActiveDocument.Tables.Add(Range:=MyRange, _ | |||||||||||||
5. | If inserting text, use ranges rather than selections MyRange.InsertAfter Text:=rs.Fields(1).Value & vbTab ... runs much faster than: Selection.TypeText Text:=rs.Fields(1).Value | |||||||||||||
6. | If inserting a large amount of text into the document, make At the end of your macro, Dim SpellSetting As | |||||||||||||
7. | Applying manual formatting is very resource-hungry – | |||||||||||||
8. | When cycling through table cells, never refer to a table And don't move selection from cell to cell, as this will also slow your Whilst it is much faster to cycle through the Cells collection, as in: Sub ... a much faster method still (with screen updating switched off) is to select Sub OperateOnEveryCellInSelectedTable() When I timed the above macros in Word 97 and in Word 2000, using a 350-row,
The above results were obtained with a table created in Word 97. If the I have no theories to explain these results, but they are easy to Turning off screen updating made no difference to the speed of the OperateOnEveryCellUsingTableObject()
| |||||||||||||
9. | When operating on specific rows, or comparing the contents | |||||||||||||
10. | If you want to operate on the cells in a specific table By far the fastest way of operating on a specific column is to select it Sub OperateOnSelectedColumn3() Note that you cannot safely use the Columns object to specify which Selection.Tables(1).Columns(3).Select .. because that gives an error message: “Cannot access individual columns in this collection because the table has mixed cell If there might be merged cells in row 1 of the table, you could select the Dim oRow As Instead of selecting the column you could cycle through every cell Sub OperateOnColumn3UsingRanges() ... but this is not only much slower than selecting the column, but When I timed the above macros in Word 97 and in Word 2000, using a 350-row,
The above results were obtained with a table created in Word 97. If the As with 7. above, I have no theories to explain these results, but they are easy to
| |||||||||||||
11. | If formatting the borders and shading of a table, it is far In essence, this is For a more detailed discussion of the principles behind this, and for some code | |||||||||||||
12. | If doing a great deal of formatting of tables, then even all
|
If you use all these tricks, you will find that the performance of
tables is not an issue, even in Word 2000 and higher.
E vamos testando... agora via link pequeno embaixo à direita
|
clipped from addons.mozilla.org
|
Post Inicial
Sempre há uma primeira vez...
Decidi fazer um blog para compartilhar, comentar e discutir sobre o MsExcel, VBA e demais aplicativos do MsOffice. O BrOffice, até o momento, é incidental, e também pode ser incluído em posts... Pretendo fazer deste espaço um complemento à minha atuação junto às duas principais listas brasileiras de discussão sobre o MsExcel/VBA: ExcelBr e Excel-Avançado. Eventuais arquivos relativos aos posts, bem como outros avulsos, são depositados no eSnips.