代码成功删除了表格边框,并且在屏幕上显示正常。
打印或打印预览时,显示一些表格边框。如何解决?
Sub Tableformatting ()
Dim r As Long, c As Long
Dim t As Table
Set t = ActiveWindow.Selection.ShapeRange.Table
For r = 1 To t.Rows.Count
For c = 1 To t.Columns.Count
With t.Cell(r, c)
.Borders(ppBorderTop).Transparency = 0
.Borders(ppBorderTop).Weight = 0
.Borders(ppBorderBottom).Transparency = 0
.Borders(ppBorderBottom).Weight = 0
.Borders(ppBorderLeft).Transparency = 0
.Borders(ppBorderLeft).Weight = 0
.Borders(ppBorderRight).Transparency = 0
.Borders(ppBorderRight).Weight = 0
End With
Next c
Next r
End Sub
最佳答案
尝试使用
Sub Tableformatting()
Dim r As Long, c As Long
Dim t As Table
Set t = ActiveWindow.Selection.ShapeRange.Table
For r = 1 To t.Rows.Count
For c = 1 To t.Columns.Count
With t.Cell(r, c)
.Borders(ppBorderTop).Transparency = 1
.Borders(ppBorderBottom).Transparency = 1
.Borders(ppBorderLeft).Transparency = 1
.Borders(ppBorderRight).Transparency = 1
End With
Next c
Next r
End Sub
出于某种原因,.Transparency = 0 仅适用于主动可见的内容,但 .Transparency = 1 适用于您要求的所有内容。这可能是 Microsoft 端的一个错误,因为我不明白为什么此方法或 .Borders.Visible = msoFalse 不适用于打印/打印预览。
无论如何,我希望这对您有所帮助!
关于vba - 删除powerpoint中的表格边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34684106/