Hi tinfanide,
See attached. I've fixed the code - plus I declared a couple of undecalred variable and re-formatted the code for legibility. You would do well to manage your own code this way, as it makes the structure much easier to follow. The fix involved telling Word specifically whether to restart or continue the numbering. I also replaced a few unnecessary loops with Repeat statements.
Your code also contains numerous blocks of repeated procedures. These could be turned into one or two separate subs, which your main procedure would then call as needed. Your Word automation could also be made to un much faster by turning screen updating off for the duration of the document's update. Even more efficient would be to have all the required tables etc. in a template and, if the data changes, simply re-populate the relevant ranges with the required data.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
|