Frankly it would make more sense to create the template with the table elements already located and formatted rather than trying to format the document using lots of macro code. I would also recommend the use of ranges to locate the data rather than the selection object which can be a bit hit and miss, leading to the types of error you are encountering when the selection is not where they macro requires it to be.
I suggest that you declare all the variables you use rather than just some of them. It makes the code much easier to follow.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
|