Speed up Word Automation?

ninjatalon

Member
Joined
Sep 22, 2010
Messages
24
Programming Experience
Beginner
I have a nested loop that enters values inside a table and if necessary it makes a new tables and enters more values.

My problem is that if i have a lot of values to be enter, it might create at most 20 tables and that would be time consuming. It takes a bit when it ends up making 5 tables.

Is multithreading possible?
VB.NET:
oTable=oDoc.Tables(1)
do while start<end

   do while start2<end2

      oTable.Cell(8 , 4).Range.Text = "X"
      oTable.Cell(8 , 5).Range.Text = "X"
      oTable.Cell(8 , 6).Range.Text = "X"
      oTable.Cell(8 , 7).Range.Text = "X"
      oTable.Cell(8 , 8).Range.Text = "X"
      oTable.Cell(8 , 9).Range.Text = "X"
      oTable.Cell(8, 10).Range.Text = "X"

loop

loop

this about 5% of the code i have inside the nested loops and the code is partial(for demostration reasons
 
If you are running in Debug mode or if the actual Office application is visible this can significantly slow things down. But for the most part Office and VBA is not lightning quick for larger operations like this.
 
Back
Top