ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can't change the size of the plot area (https://www.excelbanter.com/excel-programming/412281-cant-change-size-plot-area.html)

Phil Stanton[_2_]

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




All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com