Sub 去自动编号Example()
ActiveDocument.Content.ListFormat.ConvertNumbersToText
End Sub
Sub TRADOS编辑符号去除()
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("tw4winMark")
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^?"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub TRADOS双语基本设置加空格()
Selection.WholeStory
With Selection.Font
.NameFarEast = ""
.NameAscii = ""
.NameOther = ""
.Name = ""
.Hidden = False
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "{0>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "{0>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<0}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#{>"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
S
election.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#^#{>"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#^#^#{>"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Font.Name = "宋体"
Selection.Font.Name = "Times New Roman"
Selection.Font.Name = "宋体"
Selection.Font.Name = "Times New Roman"
ActiveDocument.KerningByAlgorithm = True
ActiveDocument.JustificationMode = wdJustificationModeCompress
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakJapanese
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakKorean
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakTraditionalChinese
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakSimplifiedChinese
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
End Sub
Sub TRADOS双语设置2()
Selection.WholeStory
With Selection.Font
.NameFarEast = ""
.NameAscii = ""
.NameOther = ""
.Name = ""
.Hidden = False
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "{0>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "{0>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.M
atchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<0}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#{>"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#^#{>"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#^#^#{>"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Font.Name = "宋体"
Selection.Font.Name = "Times New Roman"
Selection.Font.Name = "宋体"
Selection.Font.Name = "Times New Roman"
ActiveDocument.KerningByAlgorithm = True
ActiveDocument.JustificationMode = wdJustificationModeCompress
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakJapanese
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakKorean
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakTraditionalChinese
ActiveDocu
ment.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakSimplifiedChinese
ActiveDocument.FarEastLineBreakLevel = wdFarEastLineBreakLevelNormal
End Sub
Sub 文本框字数统计()
Dim lngTBWords As Long
Dim lngTBChars As Long
Dim lngDocWords As Long
Dim lngDocChars As Long
Dim shpTemp As Shape
Dim wcTemp As Dialog
Dim bDone As Boolean
On Error GoTo handler:
Application.ScreenUpdating = False
Do
bDone = True
For Each shpTemp In ActiveDocument.Shapes
If shpTemp.Type = msoGroup Then
shpTemp.Ungroup
bDone = False
End If
Next shpTemp
Loop Until bDone
Selection.HomeKey Unit:=wdStory
Set wcTemp = Dialogs(wdDialogToolsWordCount)
wcTemp.Update
wcTemp.Execute
lngDocWords = wcTemp.Words
Debug.Print lngDocWords
lngDocChars = wcTemp.Characters
Debug.Print lngDocChars
lngTBWords = 0
lngTBChars = 0
For Each shpTemp In ActiveDocument.Shapes
shpTemp.Select
If Len(shpTemp.TextFrame.TextRange.Text) >= 2 Then
wcTemp.Execute
lngTBWords = lngTBWords + wcTemp.Words
lngTBChars = lngTBChars + wcTemp.Characters
End If
two: Next shpTemp
lngDocWords = lngDocWords + lngTBWords
lngDocChars = lngDocChars + lngTBChars
Application.ScreenUpdating = True
MsgBox "文本框总数" & " " & Str(ActiveDocument.Shapes.Count) & vbCr _
& "文本框字数" & " " & Str(lngTBWords) & vbCr _
& "文本框字符数" & " " & Str(lngTBChars) & vbCr & vbCr _
& "全文字数" & " " & Str(lngDocWords) & vbCr _
& "全文字符数" & " " & Str(lngDocChars)
Exit Sub
handler:
Resume two
End Sub
Sub 选择所有表格()
Dim tempTable As Table
Application.ScreenUpdating = False
ActiveDocument.DeleteAllEditableRanges (wdEditorEveryone)
For Each tempTable In ActiveDocument.Tables
tempTable.Range.Editors.Add wdEditorEveryone
Next
ActiveDocument.SelectAllEditableRanges wdEditorEveryone
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
Application.ScreenUpdating = True
End Sub
Sub 全文表格格式调整()
Dim atable As Table
For Each atable In ActiveDocument.Tables
With atable.Range.Paragraphs
.LeftIndent = 0
.RightIndent = 0
.FirstLineIndent = 0
.CharacterUnitFirstLineIndent = 0
.CharacterUnitLeftIndent = 0
.SpaceAfterAuto = flase
.SpaceAfter = 0
.LineUnitAfter = 0.1
.SpaceBeforeAuto = flase
.SpaceBefore = 0
.LineUnitBefore = 0.1
.Alignment = wdAlignParagraphCenter
End With
With atable.Range.Font
.Size = 10.5
End With
With atable.Rows
.HeightRule = wdRowHeightAuto
.Alignment = wdAlignRowCenter
End With
atable.AutoFitBehavior (wdAutoFitWindow)
Next
End Sub
Sub 删空行()
Dim l
As Paragraph
Application.ScreenUpdating = False
For Each l In ActiveDocument.Paragraphs
If Len(l.Range) = 1 Then
l.Range.Delete
End If
Next
Application.ScreenUpdating = True
End Sub
Sub 全半()
Dim a As Range
Set a = ActiveDocument.Range
a.CharacterWidth = wdWidthHalfWidth
End Sub
Sub 自动生成三级目录菜单()
With ActiveDocument
.TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _
LowerHeadingLevel:=3, IncludePageNumbers:=True, AddedStyles:="", _
UseHyperlinks:=False, HidePageNumbersInWeb:=True, UseOutlineLevels:= _
False
.TablesOfContents(1).TabLeader = wdTabLeaderDots
.TablesOfContents.Format = wdIndexIndent
End With
End Sub
Sub 双语排版()
'
' Trados 双语排版
' 用Tradso翻译完成后进行双语排版。
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}^#^#{>"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.CorrectHangulEndings = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "{0>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.CorrectHangulEndings = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "<0}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.CorrectHangulEndings = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<}0{>"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.CorrectHangulEndings = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "<}100{>"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.CorrectHangulEndings = False
.MatchWildcards = False
.MatchSoun
dsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
With Selection.Font
.Hidden = False
End With
End Sub
本文来源:https://www.2haoxitong.net/k/doc/abe9af0490c69ec3d5bb7550.html