0
누군가가 "개체가 속성 또는 메서드를 지원하지 않습니다."라는 오류 메시지를 내게 설명 할 수 있습니까? 디버거를 살펴보면 ".Datalabels"은 지원되지 않는 것으로 보입니다. 차트 대신 개체를 지정했기 때문입니까?개체가 속성 또는 메서드 '.DataLabels'을 지원하지 않습니다.
첫 번째 서브 루틴은 하나의 차트 또는 여러 차트를 선택했는지 결정해야합니다. 두 번째 서브 루틴은 내 서식을 차트에 적용한다고 가정합니다.
Sub DetermineSelection()
'Determines what to process (active chat or selected chart)
Dim obj As Object
If Not ActiveChart Is Nothing Then
FormatNASATLXChart ActiveChart
Else
For Each obj In Selection
If TypeName(obj) = "ChartObject" Then
FormatNASATLXChart obj.Chart
End If
Next
End If
End Sub
두 번째 서브 루틴은 차트 내 서식을 적용한다고 가정한다. With cht.SeriesCollection(1)
당신은 5 반복되는 코드를 대체 할 수있는 줄 뒤에
.HasDataLabels = True
오른쪽 :
.DataLabels = True
에 :
Sub FormatNASATLXChart(cht As Chart)
'Format chart with NASA TLX Label (i.e. Mental Workload)
With cht.SeriesCollection(1)
.DataLabels = True
.ShowSeriesName = True
.ShowValue = False
.Position = xlLabelPositionInsideBase
End With
With cht.SeriesCollection(2)
.HasDataLabels = True
.ShowSeriesName = True
.ShowValue = False
.Position = xlLabelPositionInsideBase
End With
With cht.SeriesCollection(3)
.HasDataLabels = True
.ShowSeriesName = True
.ShowValue = False
.Position = xlLabelPositionInsideBase
End With
With cht.SeriesCollection(4)
.HasDataLabels = True
.ShowSeriesName = True
.ShowValue = False
.Position = xlLabelPositionInsideBase
End With
With cht.SeriesCollection(5)
.HasDataLabels = True
.ShowSeriesName = True
.ShowValue = False
.Position = xlLabelPositionInsideBase
End With
End Sub
나는 그런 것 같다고 생각했지만 '.DataLabels'에 문제가 있다는 것을 나타내는 참조 자료를 보지 못했습니다. 이제 '.ShowSeriesName'과 동일한 오류 메시지가 나타납니다. 그러나 [this] (https://msdn.microsoft.com/en-us/vba/powerpoint-vba/articles/datalabels-showseriesname-property-powerpoint)에 따르면 이는 유효한 구문입니다. – OneBigNewbie