Change Chart Dimensions using VBA

TimTDP

Registered User.
Local time
Today, 03:20
Joined
Oct 24, 2008
Messages
213
I have the following code and to resize a chart on a report:

Public Function CreateChart(ReportName As String, ChartObjectName As String)

Dim Rpt As Report
'Dim grphChart As Object
Dim grphChart As Graph.Chart
Dim msg As String, lngType As Long, cr As String
Dim ctype As String, typ As Integer, j As Integer
Dim recSource As String
Dim colmCount As Integer, chartType(1 To 6) As String
Dim lngTwisp As Long

'lngTwisp = 1440 'Inch
lngTwisp = 567 'cm

'On Error GoTo ColumnChart_Err

DoCmd.OpenReport ReportName, acViewDesign

Set Rpt = Reports(ReportName)

Set grphChart = Rpt(ChartObjectName).Object

grphChart.Activate

'Chart Dimensions
With grphChart
.Left = pubChartLeft * lngTwisp
.Top = pubChartTop * lngTwisp
.Width = pubChartWidth * lngTwisp
.Height = pubChartHeight * lngTwisp
End With

The chart does not resize!

I have also noticed that although pubChartWidth = 10, if I hover over .Width Access returns 1258. It should be 5670!

What am I doing wrong?
 

Users who are viewing this thread

Back
Top Bottom