View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Hagan Jim Hagan is offline
external usenet poster
 
Posts: 10
Default excel vba problem

I use the following in my own chart formatting routine ...

------------------------------------------------------
'Place and Resize Chart Area
With ActiveSheet.ChartObjects(chtIndex)
.Activate
.Height = 250
.Width = 350
.Placement = xlFreeFloating
.PrintObject = True
.Locked = True
End With
------------------------------------------------

Note that the Height property is set using the ChartObjects object, not the
ChartArea object.

Regards,

Jim


"Patrick Elhorga" wrote:

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 Width is a 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#

ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Height = hauteur
End Sub