Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default excel vba problem

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel vba problem

why not just set the height of the ChartObject

ActiveSheet.ChartObjects("Graphique 1").Height = hauteur + 5





--
Regards,
Tom Ogilvy

"Patrick Elhorga" 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 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default excel vba problem

Thanks a lot but this only works for chartobjects within a sheet

my problem concerns also charts within graph sheets where there is no
chartobjects
in this case it seems that I must use the "ActiveChart.ChartArea" object and
its height/width is not writable

--
Patrick. Elhorga )
Project Manager
Geosciences Software Division
Beicip Franlab
tel: 33 (0)5 59 80 18 75
fax: 33 (0)5 59 84 42 96
___________________________________
Visit our Web site at http://www.beicip.com/



"Tom Ogilvy" a écrit dans le message de news:
...
why not just set the height of the ChartObject

ActiveSheet.ChartObjects("Graphique 1").Height = hauteur + 5





--
Regards,
Tom Ogilvy

"Patrick Elhorga" 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 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Problem viewing Excel 2003 Pivot Chart fields in Excel 2007 ronny B Charts and Charting in Excel 1 October 24th 08 10:08 PM
Weird problem with Excel 2000...Worksheets disappearing in a shared Excel file BrianL_SF Excel Discussion (Misc queries) 2 October 10th 06 08:27 PM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
Excel 97 chart opened in Excel 2003 - Source Data problem DHunt Charts and Charting in Excel 0 December 6th 04 08:05 PM


All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"