M
Mike Clayton
Hi All,
I'm trying to set the ChartArea.Width property of an MS Graph object
embedded in a PowerPoint 2003 presentation but I'm getting the following
error:
Run-time error '1004': Unable to set the Width of the ChartArea class
According to the MSDN documentation the Width is a read-write property so
I'm not sure what the problem is. (see
http://msdn.microsoft.com/library/d...en-us/vbagr11/html/grproWidth1_HV03077602.asp).
My code is below, and the error occurs at line 27. If anyone can shed some
light on this it would be greatly appreciated.
Regards,
Mike
' *** BEGIN CODE ***
Option Explicit
Public Sub UpdateChart()
Dim objSrcShape As PowerPoint.Shape
Dim objSrcChart As Graph.Chart
' get references to the shape and chart objects to manipulate
Set objSrcShape = ActiveWindow.Selection.ShapeRange(1)
Set objSrcChart = objSrcShape.OLEFormat.Object
' resize the powerpoint shape that contains the chart
objSrcShape.Top = 109.875
objSrcShape.Left = 120
objSrcShape.Width = 480
objSrcShape.Height = 320.25
' resize the chart inside the shape
objSrcChart.Top = -32
objSrcChart.Left = -6
objSrcChart.Width = 550
objSrcChart.Height = 397
' resize the chart's chartarea object
' *** (the next line raises the 1004 error) ***
objSrcChart.ChartArea.Width = 473
objSrcChart.ChartArea.Height = 323
' resize the chart's plotarea object
objSrcChart.PlotArea.Top = 8
objSrcChart.PlotArea.Left = 8
objSrcChart.PlotArea.Width = 379
objSrcChart.PlotArea.Height = 297
End Sub
' *** END CODE ***
I'm trying to set the ChartArea.Width property of an MS Graph object
embedded in a PowerPoint 2003 presentation but I'm getting the following
error:
Run-time error '1004': Unable to set the Width of the ChartArea class
According to the MSDN documentation the Width is a read-write property so
I'm not sure what the problem is. (see
http://msdn.microsoft.com/library/d...en-us/vbagr11/html/grproWidth1_HV03077602.asp).
My code is below, and the error occurs at line 27. If anyone can shed some
light on this it would be greatly appreciated.
Regards,
Mike
' *** BEGIN CODE ***
Option Explicit
Public Sub UpdateChart()
Dim objSrcShape As PowerPoint.Shape
Dim objSrcChart As Graph.Chart
' get references to the shape and chart objects to manipulate
Set objSrcShape = ActiveWindow.Selection.ShapeRange(1)
Set objSrcChart = objSrcShape.OLEFormat.Object
' resize the powerpoint shape that contains the chart
objSrcShape.Top = 109.875
objSrcShape.Left = 120
objSrcShape.Width = 480
objSrcShape.Height = 320.25
' resize the chart inside the shape
objSrcChart.Top = -32
objSrcChart.Left = -6
objSrcChart.Width = 550
objSrcChart.Height = 397
' resize the chart's chartarea object
' *** (the next line raises the 1004 error) ***
objSrcChart.ChartArea.Width = 473
objSrcChart.ChartArea.Height = 323
' resize the chart's plotarea object
objSrcChart.PlotArea.Top = 8
objSrcChart.PlotArea.Left = 8
objSrcChart.PlotArea.Width = 379
objSrcChart.PlotArea.Height = 297
End Sub
' *** END CODE ***