CAT-Tools/SDL Trados/Forcing Segmentation

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Workbench does not allow users to select where segmentation should occur. This is often a problem. Uwe Sprengart has kindly provided a solution to this important functionality issue and given permission to post it. It is a macro as below. If you do not know how to add a macro to Word, www.nla.gov.au/kinetica/download/requestmacro.doc will help with Word 2003 and earlier.

Sub DefineAndOpenSegment()
' Macro by Uwe Sprengart
'
If Selection.Range = "" Then Exit Sub
Application.Run
MacroName:="TemplateProject.tw4winProtection.tw4winKeyEditCut"
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Start_TU"
.DefaultSorting = wdSortByName
.ShowHidden = True
End With

Selection.Style = ActiveDocument.Styles("tw4winMark")
Selection.TypeText Text:="{0>"
Application.Run MacroName:="Normal.EditPaste.MAIN"
Selection.Style = ActiveDocument.Styles("tw4winMark")
Selection.TypeText Text:="<}0{><0}"

' Selection.Find.ClearFormatting
' With Selection.Find
' .Text = "{0>"
' .Replacement.Text = ""
' .Forward = False
' .Wrap = wdFindAsk
' .Format = False
' .MatchCase = False
' .MatchWholeWord = False
' .MatchWildcards = False
' .MatchSoundsLike = False
' .MatchAllWordForms = False
' End With
' Selection.Find.Execute
Selection.GoTo What:=wdGoToBookmark, Name:="Start_TU"
ActiveDocument.Bookmarks("Start_TU").Delete

Application.Run MacroName:="TemplateProject.tw4winOpenGet.Main"
Application.Run MacroName:="TemplateProject.tw4winGetTranslation.Main"
End Sub