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

首頁 > 辦公 > Word > 正文

設(shè)置Word表格的VBA代碼

2024-08-22 13:26:54
字體:
供稿:網(wǎng)友

   VBA代碼設(shè)置Word表格屬性。

  Dim i As Table, N As Integer

  On Error Resume Next ’忽略錯(cuò)誤

  Application.ScreenUpdating = False ’關(guān)閉屏幕更新

  For Each i In ActiveDocument.Tables ’在表格中循環(huán)

  With i

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

  With .Borders ‘邊框

  .InsideLineStyle = wdLineStyleSingle ’設(shè)置內(nèi)部邊框線條

  End With

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

  .LineStyle = wdLineStyleDouble ‘雙線型

  .LineWidth = wdLineWidth050pt

  .Color = wdColorAutomatic

  End With

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

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

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

  .Texture = wdTextureNone ’無底底紋

  .ForegroundPatternColor = wdColorAutomatic

  .BackgroundPatternColor = wdColorGray125

  End With

  End If

  End If

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

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

  Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

  Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter

  Next N

  End With

  Next i

  Application.ScreenUpdating = True

  以上的代碼功能為:表格集合中的循環(huán)與對(duì)單元格邊框的設(shè)置。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 石家庄市| 景宁| 阳谷县| 威远县| 临桂县| 吉林市| 宁远县| 韶关市| 滁州市| 无极县| 亚东县| 兰考县| 固安县| 宁明县| 山丹县| 长子县| 永修县| 隆子县| 长治县| 拉萨市| 双牌县| 仙居县| 玉田县| 城市| 金平| 西乌珠穆沁旗| 天气| 泾阳县| 中牟县| 同心县| 仲巴县| 渭源县| 辉南县| 承德市| 葵青区| 华宁县| 丹阳市| 平定县| 南漳县| 灵寿县| 泰州市|