View Single Post
 
Old 06-21-2017, 10:50 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Using your test document, which is far more complex than I had anticipated, the process is indeed much slower than in Word 2010 and even in 2010, your test document took rather longer than 8 seconds, however while my PC may have a lot of memory and a very fast drive, it does not have a particularly fast processor.

As you are processing a lot of paragraphs sequentially, there is not a lot you can do to speed that process.

If you can eliminate many (or all) of the unwanted paragraphs using the replace function then the process would have less to do and thus be faster. 'Replace' is infinitely faster than the paragraph looping.

e.g. a wildcard search for
\! \! \!*^13
replace with nothing will remove a lot of unwanted paragraphs very quickly and the processing time of your macro was then reduced to a third.

You should be able to remove many of the others similarly, but as the document is a mock up without real values, it is difficult to suggest the wildcard strings required, however see http://www.gmayor.com/replace_using_wildcards.htm
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote