|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
加一句代码直接隐藏表格虚框
- Sub test()
- Dim t As Word.Table, Cell As Word.Cell, s As String
- ActiveWindow.View.TableGridlines = False '隐藏表格虚框
- For Each t In ActiveDocument.Tables
- For Each Cell In t.Range.Cells
- s = Replace(Replace(Cell.Range.Text, Chr(7), ""), Chr(13), "")
- If Right(s, 2) = "气主" Or s = "客" Then
- With Cell
- With .Borders(wdBorderRight)
- .LineStyle = wdLineStyleNone '取消表格右边框
- End With
- .Range.ParagraphFormat.Alignment = wdAlignParagraphRight '当前单元格右对齐
- .Next.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft '右侧单元格左对齐
- End With
- End If
- Next
- Next t
- End Sub
复制代码
|
|