ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variable print area? (https://www.excelbanter.com/excel-programming/357615-re-variable-print-area.html)

Jim Cone

variable print area?
 

The worksheet and charts on the worksheet have
independent PageSetUp properties. The modified code
below adds the chart title text to the chart header.
It does not affect the header for the worksheet.
'-----------------------
Sub PrintAllCharts2()
Dim objChtObjects As Excel.ChartObjects
Dim objCht As Excel.ChartObject

Set objChtObjects = ActiveSheet.ChartObjects
For Each objCht In objChtObjects
With objCht.Chart
.PageSetup.CenterHeader = .ChartTitle.Text
.PrintOut
End With
Next
Set objCht = Nothing
Set objChtObjects = Nothing
End Sub
-----------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"LadyReader"
wrote in message
Jim, that's a great answer. Right now I have:
Code:
--------------------
With ActiveSheet.PageSetup
.CenterHeader = "&26Chart 25"
.PrintTitleRows = ""
.PrintTitleColumns = ""
.CenterHorizontally = True
.CenterVertically = True
End With
--------------------

in my code. I'd like to set .CenterHeader dynamically so that the
printed page header is set to the chart title. Can you tell me how I
can address the chart title within your loop?
And the user may want to randomly select which charts to print so I am
working on a UI to allow the selection. Any ideas?
Thanks to all who responded!
LadyReader



All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com