vba - 删除powerpoint中的表格边框

标签 vba powerpoint

代码成功删除了表格边框,并且在屏幕上显示正常。

打印或打印预览时,显示一些表格边框。如何解决?

 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/

相关文章:

excel - 标签内的图像捕获

excel - 选择电子表格中的非空白行

vba - 循环工作表时运行时错误 6 溢出

.net - 在不使用 Office Automation 的情况下生成 PowerPoint 演示文稿的一些技术有哪些?

vba - 创建和评分测验的建议

c# - 寻找 Aspose .NET 幻灯片替代品

excel - 删除 VBA excel 中的空格

Excel 损坏与 VBA 排序记录

c# - 在 PowerPoint 2007 中导出时命名幻灯片图像

java - 使用java控制microsoft powerpoint(运行幻灯片等)