|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub aaaa提取单词音标中文()
- Dim r As Range, p&, t As Table, i As Paragraph, n&, k&, j!, myRange As Range, m&, h$
- h = InputBox("", "请输入分栏数:", "3")
- If h = "" Then End
- With Selection
- If .Type = wdSelectionIP Then .WholeStory
- Set r = .Range
- .EndKey 6
- With .Paragraphs(1).Range
- Do While .Paragraphs(1).Range.Text = vbCr
- .Delete
- Loop
- End With
- .EndKey 6
- .TypeParagraph
- p = r.Paragraphs.Count
- .InsertAfter Text:=r
- If .Next.Text = vbCr Then .Next.Delete
- If .Characters.Last.Text = vbCr Then .Characters.Last.Delete
- .ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=3, AutoFitBehavior:=wdAutoFitFixed
- .Tables(1).Style = "网格型"
- End With
- With Selection
- For k = 1 To 3
- Set t = ActiveDocument.Tables(1)
- t.Columns(k).Select
- With Selection
- .Copy
- .EndKey 6
- .InsertBreak
- .Paste
- End With
- ActiveDocument.Tables(2).Select
- With Selection
- .Rows.ConvertToText Separator:=wdSeparateByParagraphs, NestedTables:=False
- For Each i In .Paragraphs
- n = n + 1
- i.Range.InsertBefore Text:=n & "."
- Next
- End With
- With Selection
- .ConvertToTable Separator:=wdSeparateByParagraphs, NumColumns:=h, AutoFitBehavior:=wdAutoFitFixed
- .Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:=True
- For Each i In .Paragraphs
- i.Range.Characters.Last.InsertBefore Text:=vbTab
- Next
- Do While .Text Like "*" & vbTab & vbTab & "?"
- .Characters.Last.Previous.Delete
- Loop
- With .Range.Find
- .Replacement.Font.Underline = wdUnderlineSingle
- .Execute "^9", , , 0, , , , , 1, "", 2
- .Execute "^9", , , 0, , , , , , "^& ", 2
- End With
- End With
- Set myRange = Selection.Range
- With ActiveDocument.Sections(1).PageSetup
- j = ((.PageWidth - .LeftMargin - .RightMargin) / 28.35 - 0.25) / h
- End With
- With myRange
- For Each i In .Paragraphs
- i.Range.Select
- With Selection
- With .ParagraphFormat.TabStops
- .ClearAll
- For m = 1 To h
- .Add Position:=CentimetersToPoints(j * m), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
- Next m
- End With
- .ParagraphFormat.LeftIndent = CentimetersToPoints(0)
- End With
- Next
- With .Find
- .Font.Underline = wdUnderlineSingle
- .Replacement.Font.Underline = wdUnderlineNone
- .Execute " ", , , 0, , , , , 1, "", 2
- End With
- End With
- Selection.EndKey 6
- n = 0
- Next k
- End With
- ActiveDocument.Tables(1).Delete
- ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitFullPage
- ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitBestFit
- Selection.HomeKey Unit:=wdStory
- MsgBox "Congratulations! Complete!", 0 + 48
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|