zoukankan      html  css  js  c++  java
  • 以黄门镇黄湾村某一文档为例——简单设定单元格格式

    由于有很多个Word文件,所以应用宏会更加方便排版,而且版式较为统一。

    Sub 设置列宽()
    '
    '  设置列宽宏
    '
    '
        ActiveDocument.Tables(1).Cell(7, 2).Width = 45   '将Word表格的第7行第2列(即B7单元格)的宽度设为45
        ActiveDocument.Tables(1).Cell(7, 3).Width = 30
        ActiveDocument.Tables(1).Cell(7, 4).Width = 117
        ActiveDocument.Tables(1).Cell(7, 5).Width = 33
        ActiveDocument.Tables(1).Cell(7, 6).Width = 30
        ActiveDocument.Tables(1).Cell(7, 7).Width = 30
        ActiveDocument.Tables(1).Cell(7, 8).Width = 30
        ActiveDocument.Tables(1).Cell(7, 9).Width = 57
        ActiveDocument.Tables(1).Cell(7, 10).Width = 39
        ActiveDocument.Tables(1).Cell(7, 11).Width = 39
        ActiveDocument.Tables(1).Cell(7, 12).Width = 60
        ActiveDocument.Tables(1).Cell(7, 13).Width = 33
        ActiveDocument.Tables(1).Cell(7, 14).Width = 30
        ActiveDocument.Tables(1).Cell(7, 15).Width = 30
        ActiveDocument.Tables(1).Cell(7, 16).Width = 30
        ActiveDocument.Tables(1).Cell(7, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(7, 17).Range.Text = ""  '将Word的表格第7行第17列单元格(Q7单元格)的值设置为空
    
    
    
        ActiveDocument.Tables(1).Cell(8, 2).Width = 45
        ActiveDocument.Tables(1).Cell(8, 3).Width = 30
        ActiveDocument.Tables(1).Cell(8, 4).Width = 117
        ActiveDocument.Tables(1).Cell(8, 5).Width = 33
        ActiveDocument.Tables(1).Cell(8, 6).Width = 30
        ActiveDocument.Tables(1).Cell(8, 7).Width = 30
        ActiveDocument.Tables(1).Cell(8, 8).Width = 30
        ActiveDocument.Tables(1).Cell(8, 9).Width = 57
        ActiveDocument.Tables(1).Cell(8, 10).Width = 39
        ActiveDocument.Tables(1).Cell(8, 11).Width = 39
        ActiveDocument.Tables(1).Cell(8, 12).Width = 60
        ActiveDocument.Tables(1).Cell(8, 13).Width = 33
        ActiveDocument.Tables(1).Cell(8, 14).Width = 30
        ActiveDocument.Tables(1).Cell(8, 15).Width = 30
        ActiveDocument.Tables(1).Cell(8, 16).Width = 30
        ActiveDocument.Tables(1).Cell(8, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(8, 17).Range.Text = ""
    
    
        
        ActiveDocument.Tables(1).Cell(9, 2).Width = 45
        ActiveDocument.Tables(1).Cell(9, 3).Width = 30
        ActiveDocument.Tables(1).Cell(9, 4).Width = 117
        ActiveDocument.Tables(1).Cell(9, 5).Width = 33
        ActiveDocument.Tables(1).Cell(9, 6).Width = 30
        ActiveDocument.Tables(1).Cell(9, 7).Width = 30
        ActiveDocument.Tables(1).Cell(9, 8).Width = 30
        ActiveDocument.Tables(1).Cell(9, 9).Width = 57
        ActiveDocument.Tables(1).Cell(9, 10).Width = 39
        ActiveDocument.Tables(1).Cell(9, 11).Width = 39
        ActiveDocument.Tables(1).Cell(9, 12).Width = 60
        ActiveDocument.Tables(1).Cell(9, 13).Width = 33
        ActiveDocument.Tables(1).Cell(9, 14).Width = 30
        ActiveDocument.Tables(1).Cell(9, 15).Width = 30
        ActiveDocument.Tables(1).Cell(9, 16).Width = 30
        ActiveDocument.Tables(1).Cell(9, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(9, 17).Range.Text = ""
    
    
        
        
        
        
        ActiveDocument.Tables(1).Cell(10, 2).Width = 45
        ActiveDocument.Tables(1).Cell(10, 3).Width = 30
        ActiveDocument.Tables(1).Cell(10, 4).Width = 117
        ActiveDocument.Tables(1).Cell(10, 5).Width = 33
        ActiveDocument.Tables(1).Cell(10, 6).Width = 30
        ActiveDocument.Tables(1).Cell(10, 7).Width = 30
        ActiveDocument.Tables(1).Cell(10, 8).Width = 30
        ActiveDocument.Tables(1).Cell(10, 9).Width = 57
        ActiveDocument.Tables(1).Cell(10, 10).Width = 39
        ActiveDocument.Tables(1).Cell(10, 11).Width = 39
        ActiveDocument.Tables(1).Cell(10, 12).Width = 60
        ActiveDocument.Tables(1).Cell(10, 13).Width = 33
        ActiveDocument.Tables(1).Cell(10, 14).Width = 30
        ActiveDocument.Tables(1).Cell(10, 15).Width = 30
        ActiveDocument.Tables(1).Cell(10, 16).Width = 30
        ActiveDocument.Tables(1).Cell(10, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(10, 17).Range.Text = ""
    
    
        
        ActiveDocument.Tables(1).Cell(11, 2).Width = 45
        ActiveDocument.Tables(1).Cell(11, 3).Width = 30
        ActiveDocument.Tables(1).Cell(11, 4).Width = 117
        ActiveDocument.Tables(1).Cell(11, 5).Width = 33
        ActiveDocument.Tables(1).Cell(11, 6).Width = 30
        ActiveDocument.Tables(1).Cell(11, 7).Width = 30
        ActiveDocument.Tables(1).Cell(11, 8).Width = 30
        ActiveDocument.Tables(1).Cell(11, 9).Width = 57
        ActiveDocument.Tables(1).Cell(11, 10).Width = 39
        ActiveDocument.Tables(1).Cell(11, 11).Width = 39
        ActiveDocument.Tables(1).Cell(11, 12).Width = 60
        ActiveDocument.Tables(1).Cell(11, 13).Width = 33
        ActiveDocument.Tables(1).Cell(11, 14).Width = 30
        ActiveDocument.Tables(1).Cell(11, 15).Width = 30
        ActiveDocument.Tables(1).Cell(11, 16).Width = 30
        ActiveDocument.Tables(1).Cell(11, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(11, 17).Range.Text = ""
    
        
        
        ActiveDocument.Tables(1).Cell(12, 2).Width = 45
        ActiveDocument.Tables(1).Cell(12, 3).Width = 30
        ActiveDocument.Tables(1).Cell(12, 4).Width = 117
        ActiveDocument.Tables(1).Cell(12, 5).Width = 33
        ActiveDocument.Tables(1).Cell(12, 6).Width = 30
        ActiveDocument.Tables(1).Cell(12, 7).Width = 30
        ActiveDocument.Tables(1).Cell(12, 8).Width = 30
        ActiveDocument.Tables(1).Cell(12, 9).Width = 57
        ActiveDocument.Tables(1).Cell(12, 10).Width = 39
        ActiveDocument.Tables(1).Cell(12, 11).Width = 39
        ActiveDocument.Tables(1).Cell(12, 12).Width = 60
        ActiveDocument.Tables(1).Cell(12, 13).Width = 33
        ActiveDocument.Tables(1).Cell(12, 14).Width = 30
        ActiveDocument.Tables(1).Cell(12, 15).Width = 30
        ActiveDocument.Tables(1).Cell(12, 16).Width = 30
        ActiveDocument.Tables(1).Cell(12, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(12, 17).Range.Text = ""
    
        
        
        
        ActiveDocument.Tables(1).Cell(13, 2).Width = 45
        ActiveDocument.Tables(1).Cell(13, 3).Width = 30
        ActiveDocument.Tables(1).Cell(13, 4).Width = 117
        ActiveDocument.Tables(1).Cell(13, 5).Width = 33
        ActiveDocument.Tables(1).Cell(13, 6).Width = 30
        ActiveDocument.Tables(1).Cell(13, 7).Width = 30
        ActiveDocument.Tables(1).Cell(13, 8).Width = 30
        ActiveDocument.Tables(1).Cell(13, 9).Width = 57
        ActiveDocument.Tables(1).Cell(13, 10).Width = 39
        ActiveDocument.Tables(1).Cell(13, 11).Width = 39
        ActiveDocument.Tables(1).Cell(13, 12).Width = 60
        ActiveDocument.Tables(1).Cell(13, 13).Width = 33
        ActiveDocument.Tables(1).Cell(13, 14).Width = 30
        ActiveDocument.Tables(1).Cell(13, 15).Width = 30
        ActiveDocument.Tables(1).Cell(13, 16).Width = 30
        ActiveDocument.Tables(1).Cell(13, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(13, 17).Range.Text = ""
    
        
        
        ActiveDocument.Tables(1).Cell(14, 2).Width = 45
        ActiveDocument.Tables(1).Cell(14, 3).Width = 30
        ActiveDocument.Tables(1).Cell(14, 4).Width = 117
        ActiveDocument.Tables(1).Cell(14, 5).Width = 33
        ActiveDocument.Tables(1).Cell(14, 6).Width = 30
        ActiveDocument.Tables(1).Cell(14, 7).Width = 30
        ActiveDocument.Tables(1).Cell(14, 8).Width = 30
        ActiveDocument.Tables(1).Cell(14, 9).Width = 57
        ActiveDocument.Tables(1).Cell(14, 10).Width = 39
        ActiveDocument.Tables(1).Cell(14, 11).Width = 39
        ActiveDocument.Tables(1).Cell(14, 12).Width = 60
        ActiveDocument.Tables(1).Cell(14, 13).Width = 33
        ActiveDocument.Tables(1).Cell(14, 14).Width = 30
        ActiveDocument.Tables(1).Cell(14, 15).Width = 30
        ActiveDocument.Tables(1).Cell(14, 16).Width = 30
        ActiveDocument.Tables(1).Cell(14, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(14, 17).Range.Text = ""
    
    
        
        ActiveDocument.Tables(1).Cell(15, 2).Width = 45
        ActiveDocument.Tables(1).Cell(15, 3).Width = 30
        ActiveDocument.Tables(1).Cell(15, 4).Width = 117
        ActiveDocument.Tables(1).Cell(15, 5).Width = 33
        ActiveDocument.Tables(1).Cell(15, 6).Width = 30
        ActiveDocument.Tables(1).Cell(15, 7).Width = 30
        ActiveDocument.Tables(1).Cell(15, 8).Width = 30
        ActiveDocument.Tables(1).Cell(15, 9).Width = 57
        ActiveDocument.Tables(1).Cell(15, 10).Width = 39
        ActiveDocument.Tables(1).Cell(15, 11).Width = 39
        ActiveDocument.Tables(1).Cell(15, 12).Width = 60
        ActiveDocument.Tables(1).Cell(15, 13).Width = 33
        ActiveDocument.Tables(1).Cell(15, 14).Width = 30
        ActiveDocument.Tables(1).Cell(15, 15).Width = 30
        ActiveDocument.Tables(1).Cell(15, 16).Width = 30
        ActiveDocument.Tables(1).Cell(15, 17).Width = 70.5
        ActiveDocument.Tables(1).Cell(15, 17).Range.Text = ""
    
       
        ActiveDocument.Tables(1).AllowAutoFit = False
        
        
    End Sub

  • 相关阅读:
    Monkeyrunner学习
    js判断字符串是否包含指定的字符
    Asp.net网站后台代码不能访问-iis部署
    css分割线 文字居中的7种实现方式
    css倒三角的几种实现方式
    前端一键切图
    html中em和px
    js日期控件demo
    网页字体样式
    html特殊符号列表
  • 原文地址:https://www.cnblogs.com/xiehaofeng/p/6131142.html
Copyright © 2011-2022 走看看