View Single Post
 
Old 02-20-2012, 08:47 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,342
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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.
Attached Files
File Type: xlsm TinfanideStarters.xlsm (82.9 KB, 17 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote