Ability to have a subtotal logic in MS Word

Hi

I have program that exports data into a Word document. The program is currently exporting the data corrrectly in the correct columns as a table. One of the column is an amount field.

The users now have a new request. They need a subtotal of the amount field on every page. I understand how to insert a formula to Total data this works across the entire document. (Eg. Sum(Above))

Any suggestions?

Thank you,
NaviWorldSGAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
I don't believe that this is practical using Word fields alone.

Firstly, how would you know where the page breaks will fall. Secondly, where would the subtotals appear?

 However, ignoring such difficulties, and supposing that you always have 6 rows, plus a subtotal row per page and the numbers are in the second column, then the formula field in the first subtotal row would be { = SUM(B1:B6) }. The second would be  { = SUM(B8:B13)  } and so on. The grand total would be { = SUM(B7, B14, B21) } etc.

It could be done with VBA, but of course the code would have to be run when the document is otherwise complete, just before printing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NaviWorldSGAuthor Commented:
>>Firstly, how would you know where the page breaks will fall.
The Table property has the ability to Repeat as header row at the top of each page. I was hoping that there was a similar logic for the footer of a table.

 >>Secondly, where would the subtotals appear?
At the bottom of the table for each. The table logic has a Repeat as header row at the top of each page.

>>It could be done with VBA
If VBA is the only solution, my concern is that there are other Word Macros and Add-ons which may be affected.
0
GrahamSkanRetiredCommented:
The facility to repeat the header row is only a display and print mechanism. There isn't an actual new row inserted into the table. As such, each repeat is identical to the actual first row,

The only likely interference is with another 'last-minute' macro .
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.