Which is faster - InsertAfter or Text=

C

cjg.groups

Hello, I am using VBA to put data from Access 2003 queries into Word
2003 tables. Which is the more desirable method for putting text into
a Word table cell:

Document.Tables(i).Cell(r,c).Range.InsertAfter Recordset.Fields(j)
Document.Tables(i).Cell(r,c).Range.Text = Recordset.Fields(j)

This call will be run about 4000 times in 100 Word documents.
Currently, InsertAfter completes this in a few seconds.

Code I got from the newsgroups used InsertAfter, but this requires me
to first delete some existing table text which "Range.Text" would
otherwise overwrite.
 
D

Doug Robbins - Word MVP

I doubt that you would notice the difference, if there is any. That
notwithstanding, the need to remove any existing text would definitely swing
it in favour of using .Text =

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top