word 修改 表宽度

Private Sub Document_New()


For Each tb In ThisDocument.Tables
  
   tb.AllowAutoFit = False
  
   For Each col In tb.Columns
  
     col.Width = 50
    
   Next
  
  
Next


 

For Each oTable In ThisDocument.Tables

   Dim oCols As Integer
  
   oCols = oTable.Columns.Count
  
     For Each oCol In oTable.Columns

        If oCols = 2 Then
           Select Case oCol.Index
             Case 1
             oCol.Width = 120
             Case 2
              oCol.Width = 130
             
         End Select
       
        End If
       
        If oCols = 4 Then
       
            Select Case oCol.Index
            Case 1
               oCol.Width = 120
              
            Case 2
               oCol.Width = 130
              
            Case 3
               oCol.Width = 60
              
            Case 4
               oCol.Width = 80
              
           End Select
          
        End If
       
        Next oCol
       
         
    Next oTable

End Sub

转载于:https://www.cnblogs.com/kevinkim/archive/2011/12/30/2307956.html

猜你喜欢

转载自blog.csdn.net/weixin_33850890/article/details/94493083
今日推荐