【发布时间】:2012-02-01 00:55:30
【问题描述】:
我正在做一个项目。在那我想检查图表是否有 x 或 y 轴。如果没有,则添加它。甚至我也想检查 x 或 y 轴是否有标题。如果没有,请提供标题。
我写了一个代码来检查 x 或 y 轴是否有标题。但如果不是,那么如何为其添加标题?
这是查找坐标轴标题的代码
Dim oSld As Slide
Dim oShp As Shape
Dim oShapes As Shapes
Dim yaxes as Boolean
Dim xaxes as Boolean
On Error GoTo Errorhandler:
For Each oSld In ActivePresentation.Slides
Set oShapes = oSld.Shapes
For Each oShp In oShapes
If oShp.HasChart Then
If oShp.HasChart Then
yaxes = oShp.Chart.Axes(xlValue, xlPrimary).HasTitle
xaxes = oShp.Chart.Axes(xlCategory).HasTitle
'check x axies have title
If xaxes <> True Then
' Add title
End If
'check y axies have title
If yaxes <> True Then
' Add title
End If
End If
End If
Next oShp
Next
所以在上面的代码中,如果没有分配,我也想添加轴。
谢谢。
【问题讨论】:
标签: vba charts powerpoint