Macro: Hide Target Language Paragraphs, Show New Source Language Paragraphs
Thread poster: Hans Lenting
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
Jan 12, 2023

3

Sometimes you receive documents where the client has inserted new English paragraphs in your old German translation. With this macro you can hide the German paragraphs so that you can import only the English paragraphs in your CAT tool.

Add your test words in the line strWords = strWords & "this,short".
Adapt the languages to your needs.

Before running this macro, you'll have to select all text and hide it.
(For now, the macro only works in the main story.)


Sub UnhideEnglishParagraphs()
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
Application.ScreenUpdating = False
Dim strWords As String, i As Long
strWords = strWords & "this,short"

With ActiveDocument
With .Range
.LanguageID = wdGerman
With .Find
.Replacement.ClearFormatting
.Replacement.Text = "^&"
.LanguageID = wdGerman
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = True
End With
For i = 0 To UBound(Split(strWords, ","))
.Find.Text = Split(strWords, ",")(i)
Do While .Find.Execute
.Paragraphs.First.Range.LanguageID = wdEnglishUK
.Paragraphs.First.Range.Font.Hidden = False
.Collapse wdCollapseEnd
Loop
Next i
End With
End With
Application.ScreenUpdating = False
ActiveDocument.ActiveWindow.View.ShowHiddenText = False
End Sub




[Edited at 2023-01-12 20:35 GMT]


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Collecting Test Words Jan 13, 2023

Here is a macro that helps you to find relevant test words:

Sub HideEnglishParagraphs()
'This macro helps you to find test words
ActiveDocument.ActiveWindow.View.ShowHiddenText = False
Application.ScreenUpdating = False
Dim strWords As String, i As Long
strWords = strWords & "engine,force,pressure,steam"

With ActiveDocument
With .Range
.LanguageID = wdGerman
With .Find
.Replacement.ClearFormatting
.Replacem
... See more
Here is a macro that helps you to find relevant test words:

Sub HideEnglishParagraphs()
'This macro helps you to find test words
ActiveDocument.ActiveWindow.View.ShowHiddenText = False
Application.ScreenUpdating = False
Dim strWords As String, i As Long
strWords = strWords & "engine,force,pressure,steam"

With ActiveDocument
With .Range
.LanguageID = wdGerman
With .Find
.Replacement.ClearFormatting
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = True
End With
For i = 0 To UBound(Split(strWords, ","))
.Find.Text = Split(strWords, ",")(i)
Do While .Find.Execute
.Paragraphs.First.Range.Font.Hidden = True
.Paragraphs.First.Range.HighlightColorIndex = wdYellow
.Collapse wdCollapseEnd
Loop
Next i
End With
End With
Application.ScreenUpdating = False
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
End Sub


And here is a demo.
Collapse


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Macro: Hide Target Language Paragraphs, Show New Source Language Paragraphs






Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »
Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »