|
* 楼主,请重新测试,代码仅供参考。粉红文字为表格文字。六个星号“******”后面的文字取自文本框。
- Sub DocInfo()
- With ActiveDocument
- MsgBox "Pages = " & .ComputeStatistics(wdStatisticPages) & vbCr & _
- "Characters = " & .ComputeStatistics(wdStatisticCharacters) & vbCr & vbCr & _
- "Sections = " & .Sections.Count & vbCr & _
- "Tables = " & .Tables.Count & vbCr & vbCr & _
- "Shapes = " & .Shapes.Count & vbCr & _
- "InlineShapes = " & .InlineShapes.Count, 0 + 48, "DocInfo"
- End With
- End Sub
- Sub a_1128_DeleteShapes_Update()
- '删除图形
- Dim r As Range, iShape As InlineShape, n&
- With ActiveDocument
- .Content.InsertParagraphBefore
- Set r = .Range(0, .Paragraphs(1).Range.End)
- For Each iShape In .InlineShapes
- iShape.Delete
- Next
- For n = .Shapes.Count To 1 Step -1
- With .Shapes(n)
- If .TextFrame.HasText <> 0 Then r.InsertBefore Text:=.TextFrame.TextRange.Text
- .Delete
- End With
- Next
- .Content.InsertAfter Text:=vbCr & "******" & vbCr & r.Text
- r.Delete
- End With
- End Sub
- Sub a_a1128_Cancel_Columns()
- With ActiveDocument
- .Fields.Unlink
- .ConvertNumbersToText
- .Content.Find.Execute "^l", , , 0, , , , , , "^p", 2
-
- Dim t As Table
- For Each t In .Tables
- t.Range.Rows.WrapAroundText = False
- t.Range.Font.ColorIndex = wdPink
- Next
-
- Dim Sec As Section
- For Each Sec In .Sections
- Sec.PageSetup.TextColumns.SetCount NumColumns:=1
- Next
-
- .Content.Find.Execute "^12", , , 0, , , , , , "", 2
-
- a_1128_DeleteShapes_Update
-
- With Selection
- .HomeKey 6
- With .Find
- .ClearFormatting
- .Text = "^13^12"
- .Replacement.Text = ""
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- .HomeKey
- .Move
- .Delete
- End With
- Loop
- End With
- End With
-
- With .Content.Find
- .Execute "^n", , , 0, , , , , , "", 2
- .Execute "^t", , , 0, , , , , , "", 2
- .Execute "([ ]@)([0-9]@)", , , 1, , , , , , "^p\2", 2
- End With
-
- For Each t In .Tables
- With t
- .Select
- Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:=True
- Selection.Find.Execute "^t", , , 0, , , , , , "^p", 2
- End With
- Next
-
- With .Content.ParagraphFormat
- .LeftIndent = CentimetersToPoints(0)
- .RightIndent = CentimetersToPoints(0)
- .SpaceBefore = 0
- .SpaceBeforeAuto = False
- .SpaceAfter = 0
- .SpaceAfterAuto = False
- .LineSpacingRule = wdLineSpaceSingle
- .Alignment = wdAlignParagraphJustify
- .WidowControl = False
- .KeepWithNext = False
- .KeepTogether = False
- .PageBreakBefore = False
- .NoLineNumber = False
- .Hyphenation = True
- .FirstLineIndent = CentimetersToPoints(0)
- .OutlineLevel = wdOutlineLevelBodyText
- .CharacterUnitLeftIndent = 0
- .CharacterUnitRightIndent = 0
- .CharacterUnitFirstLineIndent = 0
- .LineUnitBefore = 0
- .LineUnitAfter = 0
- .AutoAdjustRightIndent = False
- .DisableLineHeightGrid = True
- End With
- End With
-
- Selection.HomeKey 6
- DocInfo
- End Sub
复制代码 |
|