View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phil Stanton[_2_] Phil Stanton[_2_] is offline
external usenet poster
 
Posts: 23
Default Can't change the size of the plot area

Please could anyone tell me what is wromg with this

Function GetPlan(Frm As Form, PlanPath As String) ' Get Chart background

Dim Cht As Chart
Dim ChtArea As ChartArea
Dim Msg As String

On Error GoTo ChangeChartBG_Err

Set Cht = Frm!AllocationPlan.Object
Set ChtArea = Cht.ChartArea

' Ensure Plot area is full size
Cht.Left = 0
Cht.Top = 0

Cht.ChartArea.Clear
Cht.Application.DataSheet.Range("A1").Value = 50 ' Need to feed it some
data to create a plot area
Cht.PlotArea.Width = Cht.Width
Cht.PlotArea.Height = Cht.Height - 100

Debug.Print "Plot Area Height " & Cht.PlotArea.Height & " Chart Height "
& Cht.Height
' This gives Plot Area Height 319 Chart Height 856
***************

With Cht.Axes(xlCategory)
.MinimumScale = 0
.MaximumScale = 100
End With

GetPlans:
If PlanPath "" Then
ChtArea.Fill.UserPicture PictureFile:=PlanPath
ChtArea.Fill.Visible = True
End If

ChangeChartBG_Exit:
Exit Function

ChangeChartBG_Err:
MsgBox Err.Description

End Function