Can't change the size of the plot area

P

Phil Stanton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top