I cannot find the mistake. I know that there are already similar questions. Unfortunately, it seems that I did not understand the syntax of Error Bars correctly.
'''
Dim mychart As Chart
Set mychart = oWSD.ChartObjects("Chart 1").Chart
mychart.SeriesCollection(1).ErrorBars Direction:=xlY, Include:=xlMinusValues,
Type:=xlCustom, Amount:="=Data and Graph!$B$12:$F$12", MinusValues:="=Data and
Graph!$B$12:$F$12"
''' I somehow get the error: Run-Time Error '448', Named argument not found.
Has someone an idea what is wrong? Thank you all <3
Make sure you use
mychart.SeriesCollection(1).HasErrorBars = True
before trying to set any error bar properties.
And use ErrorBar
not ErrorBars
in your posted code:
https://learn.microsoft.com/en-us/office/vba/api/excel.series.errorbar
ErrorBars
doesn't take any arguments.
Dim mychart As Chart
Set mychart = oWSD.ChartObjects("Chart 1").Chart
mychart.SeriesCollection(1).ErrorBar Direction:=xlY, _
Include:=xlMinusValues, _
Type:=xlCustom, _
Amount:="=Data and Graph!$B$12:$F$12", _
MinusValues:="=Data and Graph!$B$12:$F$12"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.