0

我正在使用 Access,我想按月自动更改图表的比例。量表应该从一个月的第一天到最后一个月。例如,在 1 月,比例为 1.Jan-31.Jan 由于是 2 月,因此比例应自动更改为 1.Feb-28.Feb。

我的代码基于 Excel 解决方案,所以这可能是问题所在。此行有错误:ctlAuf.Chart.Axes(xlValue).MinimumScale = MinChartNumber

这是我的代码:

Sub AdjustVerticalAxis() 

Dim ctlAuf As Chart
Dim MinChartNumber As Date
Dim MaxChartNumber As Date

MinChartNumber = DateSerial(Year(Date), Month(Date), 1)
MaxChartNumber = DateSerial(Year(Date), Month(Date), 0)

Set ctlAuf = Me!ctlAuf.Object
    ctlAuf.Chart.Axes(xlValue).MinimumScale = MinChartNumber
    ctlAuf.Chart.Axes(xlValue).MaximumScale = MaxChartNumber
End Sub

谢谢你的帮助

4

0 回答 0