Macro to empty target segment?
Thread poster: Laure Trads

Laure Trads  Identity Verified
Local time: 00:43
Member (2004)
English to French
Mar 10, 2008


In Workbench, I was wondering how to write a macro in Word which would allow me to empty the target segment when I do not want to use the suggested translation.
Something like:
- select segment content up to paragraph mark
- delete selection



Sylvain Leray  Identity Verified
Local time: 00:43
Member (2003)
German to French
Copy source if no match Mar 10, 2008

Hi Laure,

Doesn't the option "Copy source if no match" fit your needs ? Do you really want an empty segment ?


Edit : oops, sorry, I replied too quickly... you can use the "Copy source" as an alternative (Alt + Ins with a French keyboard)...

[Modifié le 2008-03-10 11:39]


Laure Trads  Identity Verified
Local time: 00:43
Member (2004)
English to French
I do want an empty segment Mar 10, 2008

Hi Sylvain,

This is for cases when nothing in the matching segments can be used. When this happens, I want to avoid, every single time, to have to select and delete the content of the segment in order to type my translation. It is an amazing waste of time when you repeat that operation all day. A few years ago, another translator had told me of a macro she had created to do exactly that (delete all text up to the paragraph mark), but I remember how to do it.



Johnny Speiermann
Local time: 00:43
English to Danish
+ ...
Macro Mar 10, 2008

Hi Laure,

You can use this macro (at your own risk, but it worked for me in a short test):

1. Open Word.
2. Select Tools > Macro > Macros, type a macro name, and click Create.
3. Paste the following macro into the Microsoft Visual Basic window:

With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
End With
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Application.Run MacroName:= _

(This macro simply extends the selection, finds the paragraph mark, goes one character to the left to deselect the paragraph mark, and then deletes the selection.)

4. Close the Microsoft Visual Basic window.
5. Assign a shortcut to the macro.

Assigning a shortcut to a macro:
1. Rightclick a toolbar in Word, and select Customize.
2. Click the Keyboard button.
3. Select Macros in the list Categories on the left.
3. Click the macro on the list on the right (has the name you entered in step 2 above).
4. Click in the field Press new shortcut key.
5. Press a new shortcut key, for example Ctrl+G. You will get a warning, if the shortcut is already used.)
6. Click Assign.

Exit Word to save the macro in the template. Otherwise it will be gone next time you start Word.


Laure Trads  Identity Verified
Local time: 00:43
Member (2004)
English to French
It works like a charm! Mar 10, 2008

This is exactly what I was looking for.
Thank you "Word Gallery"!



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

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

Macro to empty target segment?

Advanced search

BaccS – Business Accounting Software
Modern desktop project management for freelance translators

BaccS makes it easy for translators to manage their projects, schedule tasks, create invoices, and view highly customizable reports. User-friendly, integration, community-driven development – a few reasons BaccS is trusted by translators!

More info »
SDL Trados Studio 2019 Freelance
The leading translation software used by over 250,000 translators.

SDL Trados Studio 2019 has evolved to bring translators a brand new experience. Designed with user experience at its core, Studio 2019 transforms how new users get up and running and helps experienced users make the most of the powerful features.

More info »

  • All of
  • Term search
  • Jobs
  • Forums
  • Multiple search