为Excel中的DataLabel.Orientation属性分配一个负值

我已经写了下面的代码来创build一个XY散点图,并格式化这些点来创build事件/决策的可视时间线。

Sub UpdateDecisionTimelineChart() Dim scount As Integer Dim labelrotation As Integer Dim c As Range ActiveSheet.ChartObjects("chtDecisionTimeline").Activate scount = 0 For Each c In Range(Worksheets("Decision Record").Range("C7"), Worksheets("Decision Record").Range("C7").End(xlDown)) scount = scount + 1 ActiveChart.SeriesCollection.NewSeries With ActiveChart.SeriesCollection(scount) .Name = "='Decision Record'!" & c.Offset(0, 1).Address .XValues = "='Decision Record'!" & c.Address .Values = "='Decision Record'!" & c.Offset(0, -1).Address .MarkerStyle = 8 .MarkerSize = 7 .MarkerBackgroundColor = RGB(228, 10, 56) .MarkerForegroundColor = -2 .Format.Line.Visible = False .ApplyDataLabels .DataLabels.ShowValue = False .DataLabels.ShowSeriesName = True .DataLabels.Position = xlLabelPositionAbove .DataLabels.Orientation = -45 End With Next End Sub 

我所使用的资料载列如下:

范围示例

最终的时间表如下所示:

在这里输入图像说明

代码工作正常(虽然我知道这不是很漂亮),除了我尝试为.DataLabels.Orientation属性赋值-45.DataLabels.Orientation ; 这实际上设定了45的值。

MSDN指出:“此属性的值可以设置为从-90到90度的整数值,或者设置为以下常量之一。”但是,我分配的任何负整数值都会转换为正值。

是否可以给.DataLabels.Orientation属性.DataLabels.Orientation一个负值,如果是这样,怎么办?