A
Alan Z. Scharf
Hi,
I'm having a reporot print in a loofp for different stock symbols.
I need to have the X-axis number on an MSGraph horizontal bar chart, which
is formatted as Percent, change to 1 decimal place if maximum value <= 4%,
or 0 decimal places if > 4%..
Reason: If max value is < 4%, then numbers display as 1% 1% 2% 2%,
instead of 1.0%, 1.5%, 2.0%, 2.5%.
But the code below does not change the number format on the horizontal bar
chart's x_axis. No error message.
However, the smae code Does change the number format on an Area chart in the
same report, as a test. It changed the date format to 0.0% format
perfectlly.
Does anybody have any ideas why this isn't working on a bar chart, but does
on an area chart.
Is there another way to accomplish my goal?
Thanks.
Alan
Code:
--------------------------------
Note: I have lleft out the "4%" If condition for simplicity.
' Set X-axis format to one decimal place if maximum value <=.04%
' ----------------------------------------------------------------
Set objChart = Reports(strReportName)![chtPerformanceByStrategy]
With objChart.Object.Application.Chart
With objChart.Object.Application.Chart.Axes(1)
.TickLabels.NumberFormat = "0.0%"
End With
End With
I'm having a reporot print in a loofp for different stock symbols.
I need to have the X-axis number on an MSGraph horizontal bar chart, which
is formatted as Percent, change to 1 decimal place if maximum value <= 4%,
or 0 decimal places if > 4%..
Reason: If max value is < 4%, then numbers display as 1% 1% 2% 2%,
instead of 1.0%, 1.5%, 2.0%, 2.5%.
But the code below does not change the number format on the horizontal bar
chart's x_axis. No error message.
However, the smae code Does change the number format on an Area chart in the
same report, as a test. It changed the date format to 0.0% format
perfectlly.
Does anybody have any ideas why this isn't working on a bar chart, but does
on an area chart.
Is there another way to accomplish my goal?
Thanks.
Alan
Code:
--------------------------------
Note: I have lleft out the "4%" If condition for simplicity.
' Set X-axis format to one decimal place if maximum value <=.04%
' ----------------------------------------------------------------
Set objChart = Reports(strReportName)![chtPerformanceByStrategy]
With objChart.Object.Application.Chart
With objChart.Object.Application.Chart.Axes(1)
.TickLabels.NumberFormat = "0.0%"
End With
End With