在 Word 文档的表格上分布列宽 [英] Distribute Column Width on Table of Word Document

查看:77
本文介绍了在 Word 文档的表格上分布列宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是到 Word 文档的顶部,找到第 6 个表格,将表格格式化为Arial"和字体 9 并分配列宽.

My goal is to go to the top of the Word document, find the 6th table, and format the table to "Arial" and font 9 and distribute the column width.

问题在于它不分配列宽,而是分配其他两个.

The problem is that it doesn't distribute the column width but does the other two.

Sub TableFormat()

Selection.GoTo wdGoToPage, wdGoToAbsolute, 1
Selection.GoTo What:=wdGoToTable, Which:=GoToNext
Selection.GoTo What:=wdGoToTable, Which:=GoToNext
Selection.GoTo What:=wdGoToTable, Which:=GoToNext
Selection.GoTo What:=wdGoToTable, Which:=GoToNext
Selection.GoTo What:=wdGoToTable, Which:=GoToNext
Selection.GoTo What:=wdGoToTable, Which:=GoToNext
    Selection.Tables(1).Select
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 9
       If Selection.Cells.Count >= 2 Then
          Selection.Cells.DistributeWidth
       End If
End Sub

推荐答案

这应该可以为你解决所有疯狂的Selecting :)

This should do the trick for you without all that crazy Selecting :)

Sub TableFormat()
    With ActiveDocument.Tables(6)
        With .Range.Font
            .Name = "Arial"
            .Size = 9
        End With

        If .Columns.count > 1 Then .Columns.DistributeWidth
    End With
End Sub

这篇关于在 Word 文档的表格上分布列宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆