View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
filo666 filo666 is offline
external usenet poster
 
Posts: 265
Default problems changing the size of my chart

what does embedded means??? It is hard to me to belive that it is not
possible to change the size of a chart, could you answer me if it is possible
and how, your answer was not clear.

thanks.

"Peter T" wrote:

ChartArea dimensions are read only. If you are dealing with an embedded
chart

ActiveChart.Parent.Width = newWidth

Note chartobject size is a tad larger than ChartArea size allowing for
border.

If(?) your intention is to change the size prior to printing (or viewable
size of a ChartSheet), change the margins under ActiveChart.PageSetUp, eg
..LeftMargin

Probabably better first to validate your textboxes contain valid dimentions.

NEVER use the End statement

Regards,
Peter T



"filo666" wrote in message
...
Hi, I have this code in a userform (in the Ok button):

Private Sub CommandButton1_Click()
ActiveChart.PageSetup.ChartSize = xlScreenSize
ActiveChart.ChartArea.Height = CLng(TextBox1)
ActiveChart.ChartArea.Width = CLng(TextBox2)
End
End Sub

when I select the chart and run the macro the following error occurs:

Run-time error '1004':

Unable to set the height property of the ChartArea class.

I have no Idea why is this happening; I chacked everithing and it still

not
runing

Any suggestion

TIA