TABLE FORMAT v2.0
Table Format V2.0
Option ExplicitSub Table_Format_bottom_right()Dim objTable As TableDim I As IntegerSet objTable = Selection.Tables(1)With objTable''format colorsFor I = objTable.Columns.Count To 1 Step -1''ShadingShadeMod .Columns(I), IShadeMod .Rows(I), I''bordersBDR_NONE objTable.Columns(I).Borders(wdBorderHorizontal)BDR_NONE objTable.Rows(I).Borders(wdBorderVertical)BDR_Single objTable.Columns(I).Borders(wdBorderLeft)BDR_Single objTable.Rows(I).Borders(wdBorderTop)Next II = objTable.Rows.Count'objTable.Columns(I).Borders(wdBorderVertical).LineStyle = wdLineStyleDashSmallGapBDR_Dash objTable.Rows(objTable.Rows.Count).Borders(wdBorderVertical)BDR_Double objTable.Rows(objTable.Rows.Count).Borders(wdBorderTop)BDR_Thin objTable.Columns(objTable.Columns.Count).Borders(wdBorderLeft)For I = -4 To -1BDR_Thick objTable.Borders(I)Next IWith objTableWith .Rows(objTable.Rows.Count) ''last row''''.Alignment = wdAlignRowCenter ''screws up table row centering it in the page- shifting it from the rest of table.With .Range.ParagraphFormat.Alignment = wdAlignParagraphCenter.Cells.VerticalAlignment = wdCellAlignVerticalTop.Font.Bold = TrueEnd WithEnd WithobjTable.Cell(.Rows.Count, .Columns.Count).Range.ParagraphFormat.Alignment = wdAlignParagraphLeftEnd WithTableInsertCaptionEnd WithEnd SubSub ShadeMod(ObjVar As Variant, I As Integer)ObjVar.Shading.BackgroundPatternColor = ModColor(I)End SubPublic Sub TableInsertCaption(Optional objTable As Table)On Error Resume NextIf objTable Is Nothing Then Set objTable = Selection.Tables(1)If objTable Is Nothing ThenMsgBox "Please select a table first.", vbExclamation, "Error"Exit SubEnd IfobjTable.Range.InsertCaption _Label:=wdCaptionTable, _Position:=wdCaptionPositionAboveEnd SubSub BDR_NONE(Bdr As Border) ''clear bordersWith Bdr.LineStyle = wdLineStyleSingle.LineWidth = wdLineWidth100pt.LineStyle = wdLineStyleNoneEnd WithEnd SubSub BDR_Single(Bdr As Border)With Bdr.LineStyle = wdLineStyleSingle.LineWidth = wdLineWidth100ptEnd WithEnd SubSub BDR_Thin(Bdr As Border)With Bdr.LineStyle = wdLineStyleSingle.LineWidth = wdLineWidth025ptEnd WithEnd SubSub BDR_Dash(Bdr As Border)With Bdr.LineStyle = wdLineStyleDashLargeGap.LineWidth = wdLineWidth025ptEnd WithEnd SubSub BDR_Thick(Bdr As Border)With Bdr.LineStyle = wdLineStyleSingle.LineWidth = wdLineWidth150ptEnd WithEnd SubSub BDR_Double(Bdr As Border)With Bdr.LineStyle = wdLineStyleDouble''.LineWidth = wdLineWidth100pt '' no line width for complex line stylesEnd WithEnd SubFunction ModColor(I As Integer) As LongDim Colors As New Collection''add colors for order of rotationColors.Add -603914241 ''whiteColors.Add -603923969 ''grayColors.Add -721354957 ''light purpleModColor = Colors.Item((I Mod Colors.Count) + 1)End Function
Comments
Post a Comment