ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba problem with non writable chart height property (https://www.excelbanter.com/excel-programming/353148-vba-problem-non-writable-chart-height-property.html)

ppcm

vba problem with non writable chart height property
 
Hi All,

I'm trying, using a VBA macro, to set the ChartArea.Height property of an
Excel Graph object
but I'm getting the following error:

Run-time error '1004': Unable to set the Height of the ChartArea class

According to the MSDN documentation the Height is read-write



My code is below. If anyone can shed some light on this it would be greatly
appreciated.

I'm using Excel Small Business 2003

Regards,

Patrick

Sub Macro1()
''
Dim hauteur As Double
'
hauteur = 400#

Sheets("Graph1").Select
ActiveChart.ChartArea.Select
Selection.Height = hauteur
ActiveChart.ChartArea.Copy
End Sub

Remark

I know that if the graph is within a spreadsheet I could use:
ActiveSheet.ChartObjects("Graph1").Height = hauteur
but the graph is within a graph sheet and this does not run as there is no
ChartObjects in a Graph Sheet




Peter T

vba problem with non writable chart height property
 
Hi Patrick,

A chart-sheet's chart-area dimensions are determined by page setup and in
particular the margins.

Regards,
Peter T

"ppcm" wrote in message
...
Hi All,

I'm trying, using a VBA macro, to set the ChartArea.Height property of an
Excel Graph object
but I'm getting the following error:

Run-time error '1004': Unable to set the Height of the ChartArea class

According to the MSDN documentation the Height is read-write



My code is below. If anyone can shed some light on this it would be

greatly
appreciated.

I'm using Excel Small Business 2003

Regards,

Patrick

Sub Macro1()
''
Dim hauteur As Double
'
hauteur = 400#

Sheets("Graph1").Select
ActiveChart.ChartArea.Select
Selection.Height = hauteur
ActiveChart.ChartArea.Copy
End Sub

Remark

I know that if the graph is within a spreadsheet I could use:
ActiveSheet.ChartObjects("Graph1").Height = hauteur
but the graph is within a graph sheet and this does not run as there is no
ChartObjects in a Graph Sheet







All times are GMT +1. The time now is 10:23 AM.

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