Hi!
Trying all I can, googling all over the place, and my spamming my normal Access forum, I got a bit further in the seemingly pretty uncharted (hehe) world of editing a chart with VBA. I got stuck at changing the GroupingType of the axes. Found some MSDN-articles about this, but it didn't help.
Here's the code:
************
Private Sub CreateChart_Click()
Dim sChartspace As ChChart
Dim sCataxis As ChAxis
Dim sValAxis As ChAxis
Dim chConstants
Set chConstants = Me.subformChart.Form.ChartSpace.Constants
Set sChart = Me.subformChart.Form.ChartSpace.Charts(0)
Set sCataxis = Me.subformChart.Form.ChartSpace.Charts(0).Axes(chAxisPositionCategory)
Set sValAxis = Me.subformChart.Form.ChartSpace.Charts(0).Axes(chAxisPositionValue)
sCataxis.Title.Caption = "Categorie"
sCataxis.GroupingType = chAxisGroupingManual
sCataxis.GroupingUnitType = chAxisUnitWeek
sCataxis.GroupingUnit = 1
************
The last three lines generate errors.
Here's the error message:
Run-time error '-2147467259 (80004005)':
Invalid Parameter
Can someone help me with fixing this?
Trying all I can, googling all over the place, and my spamming my normal Access forum, I got a bit further in the seemingly pretty uncharted (hehe) world of editing a chart with VBA. I got stuck at changing the GroupingType of the axes. Found some MSDN-articles about this, but it didn't help.
Here's the code:
************
Private Sub CreateChart_Click()
Dim sChartspace As ChChart
Dim sCataxis As ChAxis
Dim sValAxis As ChAxis
Dim chConstants
Set chConstants = Me.subformChart.Form.ChartSpace.Constants
Set sChart = Me.subformChart.Form.ChartSpace.Charts(0)
Set sCataxis = Me.subformChart.Form.ChartSpace.Charts(0).Axes(chAxisPositionCategory)
Set sValAxis = Me.subformChart.Form.ChartSpace.Charts(0).Axes(chAxisPositionValue)
sCataxis.Title.Caption = "Categorie"
sCataxis.GroupingType = chAxisGroupingManual
sCataxis.GroupingUnitType = chAxisUnitWeek
sCataxis.GroupingUnit = 1
************
The last three lines generate errors.
Here's the error message:
Run-time error '-2147467259 (80004005)':
Invalid Parameter
Can someone help me with fixing this?