My software copies graphs into a Word document, and the document is based on various templates that users have made, therefore the usable page height varies, depending on header/footer and margins. I'm trying to optimize the graph height and there may be 2-3 graphs per page, depending on the report type.
What I have tried:
I've tried using the Range.PageSetup.PageHeight property and subtracting the Range.PageSetup.TopMargin, Range.PageSetup.BottomMargin, Range.PageSetup.HeaderDistance, and Range.PageSetup.FooterDistance, but the calculation seems to be missing something, i.e. the returned graph height is a little too big or small to fit the number of graphs per pg. I realize it depends when this calculation is done in the code, since the formatting may be adjusted, so the calculation is done just prior to coping the graph.