如何使用VBA在Microsoft Word中的endNotes上格式化表?

发布于 2025-02-05 03:36:37 字数 817 浏览 2 评论 0原文

我们如何使用VBA在Microsoft Word中仅在endNotes上格式化表?

如果我们使用此代码:

Sub FormatTableDemo()
Application.ScreenUpdating = False
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  With Tbl
    .AllowAutoFit = False
    .Rows.Alignment = wdAlignRowCenter
    .Range.Cells.VerticalAlignment = wdCellAlignVerticalTop
    .Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
    .Rows(1).Cells.VerticalAlignment = wdCellAlignVerticalCenter
    .Rows(1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
    .Columns(1).Width = CentimetersToPoints(0.95)
    .Columns(2).Width = CentimetersToPoints(0.95)
    .Columns(3).Width = CentimetersToPoints(7#)
    .Columns(4).Width = CentimetersToPoints(6#)
  End With
Next
Application.ScreenUpdating = True
End Sub

我们仅格式化所有表(不是endnote表)

How can we use VBA to format only tables at endnotes in Microsoft Word?

If we use this code:

Sub FormatTableDemo()
Application.ScreenUpdating = False
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  With Tbl
    .AllowAutoFit = False
    .Rows.Alignment = wdAlignRowCenter
    .Range.Cells.VerticalAlignment = wdCellAlignVerticalTop
    .Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
    .Rows(1).Cells.VerticalAlignment = wdCellAlignVerticalCenter
    .Rows(1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
    .Columns(1).Width = CentimetersToPoints(0.95)
    .Columns(2).Width = CentimetersToPoints(0.95)
    .Columns(3).Width = CentimetersToPoints(7#)
    .Columns(4).Width = CentimetersToPoints(6#)
  End With
Next
Application.ScreenUpdating = True
End Sub

We only format all tables (not endnote tables)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揽清风入怀 2025-02-12 03:36:37

那很简单:

For Each Tbl In ActiveDocument.StoryRanges(wdEndnotesStory).Tables

That's as simple as:

For Each Tbl In ActiveDocument.StoryRanges(wdEndnotesStory).Tables
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文