View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default 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