国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 辦公 > Word > 正文

如何設置Word表格的VBA代碼

2019-12-13 14:56:23
字體:
來源:轉載
供稿:網友
VBA代碼設置Word表格屬性。

  Dim i As Table, N As Integer

  On Error Resume Next ’忽略錯誤

  Application.ScreenUpdating = False ’關閉屏幕更新

  For Each i In ActiveDocument.Tables ’在表格中循環

  With i

  .Style = "列表型 4" ’將所有表格設置為"列表型4"的樣式

  With .Borders ‘邊框

  .InsideLineStyle = wdLineStyleSingle ’設置內部邊框線條

  End With

  With .Rows(1).Borders(wdBorderBottom) ‘第一行的底邊框

  .LineStyle = wdLineStyleDouble ‘雙線型

  .LineWidth = wdLineWidth050pt

  .Color = wdColorAutomatic

  End With

  If .Rows.Count > 1 Then ’ 如果表格行數大于1

  If Len(.Cell(2, 1).Range) <= 2 Then ’如果第二行第一列不為空

  With .Rows(2).Shading ’設置底紋

  .Texture = wdTextureNone ’無底底紋

  .ForegroundPatternColor = wdColorAutomatic

  .BackgroundPatternColor = wdColorGray125

  End With

  End If

  End If

  For N = 2 To .Columns.Count ’從第二列到最后一列

  .Columns(N).Select ’單元格對齊方式為中部居中

  Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

  Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter

  Next N

  End With

  Next i

  Application.ScreenUpdating = True

  以上的代碼功能為:表格集合中的循環與對單元格邊框的設置。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁强县| 建昌县| 历史| 鹿泉市| 河西区| 桐庐县| 蚌埠市| 诸暨市| 榆中县| 汉川市| 抚州市| 灯塔市| 班玛县| 嘉禾县| 民勤县| 淄博市| 永清县| 沙洋县| 长寿区| 家居| 余干县| 永泰县| 嘉鱼县| 松潘县| 安岳县| 高州市| 平塘县| 宜宾市| 德阳市| 和林格尔县| 天祝| 武城县| 芜湖县| 日喀则市| 林周县| 新建县| 湖口县| 大渡口区| 玛沁县| 怀集县| 庆元县|