【发布时间】:2019-03-28 22:16:56
【问题描述】:
我在 Word 2010 上使用 VBA。
我有一些代码可以向内联形状添加边框,它工作正常,但我需要能够删除边框,但这似乎不起作用。我已经搜索了这个网站,除了这个之外找不到任何东西:
Mimic word borders and shading option "apply to:" (text) with vba on an inline shape
代码如下:
子 TestAddBorders()
Dim rngShape As InlineShape
For Each rngShape In ActiveDocument.InlineShapes
With rngShape.Range.Borders
.OutsideLineStyle = wdLineStyleSingle
.OutsideColorIndex = wdPink
.OutsideLineWidth = wdLineWidth300pt
End With
Next rngShape
结束子
子 TestRemoveBorders()
Dim rngShape As InlineShape
For Each rngShape In ActiveDocument.InlineShapes
With rngShape.Range.Borders
.OutsideLineStyle = wdLineStyleNone
End With
Next rngShape
结束子
我总是留下一张带有灰色边框的图片(内联形状)。在“图片工具”>“格式”选项卡上使用“图片边框>无轮廓”将其删除,但我无法在 VBA 中找到任何方法。 wdLineStyleNone 似乎不起作用,我看不到 color = "none" 或 linewidth = "none" 的选项
谢谢。
【问题讨论】:
-
试试
.Borders.Enable = False?