我正在尝试编辑幻灯片中的表格,而我正在使用此代码。有人可以告诉我为什么它不工作?如果不是s.Shapes.Table我有s.Shapes.Range例如它工作正常。
Sub format()
Dim s As Slide
For Each s In ActivePresentation.Slides
With s.Shapes.Table
.TextFrame.TextRange.Font.Name = "Arial"
.TextFrame.TextRange.Font.Size = 30
End With
Next s
End Sub
答案 0 :(得分:1)
喜欢这样:
Sub format()
Dim s As Slide
Dim oSh As Shape
Dim oTbl As Table
Dim lRow As Long
Dim lCol As Long
For Each s In ActivePresentation.Slides
' If you choose Debug | Compile, this next line fails
' There's no such property as .Table
' With s.Shapes.Table
For Each oSh In s.Shapes
If oSh.HasTable Then
Set oTbl = oSh.Table
For lRow = 1 To oTbl.Rows.Count
For lCol = 1 To oTbl.Columns.Count
With oTbl.Cell(lRow, lCol).Shape.TextFrame.TextRange
.Font.Name = "Arial"
.Font.Size = 30
End With
Next
Next
End If
Next ' Shape
Next s
End Sub