PDA

View Full Version : Excel SUBTOTAL Pagebreak in Word Document



vloneboy
05-06-2019, 05:15 AM
Hey guys,

I have to transfer data we get from a customer in excel sheets into a word document with the help of VBA.

My main problem now is that I have to make a subtotal at the page end and transfer the result to the next page of the word document so that it's clearer.

Is there any code or way how I can do this, because I can't solve it at all.

Greetings,

Paul_Hossler
05-06-2019, 06:19 AM
Example attachment file?

vloneboy
05-06-2019, 07:56 AM
Thanks for the reply,

I made a table with 5 columns with dummy data (my original table has 8 columns) and I also added my invoice template in which the data should be transfered.

If I have a excel table with a lot of rows my word document also goes over several pages. Therefore I need a subtotal of the total boxes and prices at the end of each page in the word document. The subtotal should then be transfered to the next word page so the remaining data can be added.
I hope this more detailed explanation of my problem can help you to understand it.


Greetings,

Paul_Hossler
05-07-2019, 10:36 AM
Does the output product have to a Word document?

What I would do is make another Excel workbook with the logo, footer and header words and formatting needed, populate the 'pages' with data, add the subtotals, and save as a PDF file

It's IMHO a lot simpler to just stay in Excel and not try to integrate with Word

Also, what column(s) need to have a subtotal?

When does the subtotal reset to 0? Like "When ship date changes" reset to 0 and start subtotaling again

macropod
05-07-2019, 03:17 PM
My main problem now is that I have to make a subtotal at the page end and transfer the result to the next page of the word document so that it's clearer.
Word has no facility for that, so it would have to be coded for your particular requirements. Moreover, as soon as you switch to a different print driver (e.g. because you change printers or you email the document to someone using a different one), the layout and, hence, the locations of all your nice sub-totals are liable to change. They could end up not being on the last line or even being on the first line of the next page. That's because, unlike Excel, Word uses info from the active printer driver to optimise the page layout.