Find/replace in all open documents
Thread poster: Tom in London

Tom in London
United Kingdom
Local time: 02:38
Member (2008)
Italian to English
Jun 1, 2015

One of the most useful features of Office 2008 for Mac was that you could find/replace a word or phrase in "all open documents".

That feature was removed in Office 2011, nor is there any sign of it coming back in the new Office 2015 (of which I have a test copy).

For that reason I am still using Office 2008 for Mac, but it's getting old now and I'm wondering if anyone knows of either an Office-compatible application that has "find/replace in all open documents" or a third-party tweak (one that's easy to use) that does the same job?

I know about the other option (concatenating multiple files so that find/replace is only applied to one file- that's not always a practical way of doing it).

[Edited at 2015-06-01 16:28 GMT]


 

2nl (X)  Identity Verified
Netherlands
Local time: 03:38
"There's a macro for that" Jun 1, 2015

You can use a macro for that, if you'd be willing to install it. I could give you further instructions then.

 

Tom in London
United Kingdom
Local time: 02:38
Member (2008)
Italian to English
TOPIC STARTER
Please do! Jun 1, 2015

2nl wrote:

You can use a macro for that, if you'd be willing to install it. I could give you further instructions then.


Please do!


 

2nl (X)  Identity Verified
Netherlands
Local time: 03:38
Quick and dirty solution in VBA Jun 1, 2015

Here's a movie:

http://youtu.be/9F796GWCoKU

And here is the VBA code that you'll need:

Dim doc As Word.Document
Dim strFind As String
Dim strReplace As String

strFind = InputBox("Type the string to find", "Enter your text", "Anton")
strReplace = InputBox("Type the string to use for replacement", "Enter your text", "Johann")

For Each doc In Word.Documents
doc.Select

For Each myRange In ActiveDocument.StoryRanges
Selection.Find.ClearFormatting
With Selection.Find
.Text = strFind
.Replacement.Text = strReplace
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next myRange
Next

Start Word:mac 2011.

Copy the code above.

Create a new macro, e.g. 'findall'.

Inside the macro paste the text of the macro above. So you'll get:

Sub findall()
'
' findall Macro
'
'
Dim doc As Word.Document
Dim strFind As String
Dim strReplace As String

strFind = InputBox("Type the string to find", "Enter your text", "Anton")
strReplace = InputBox("Type the string to use for replacement", "Enter your text", "Johann")

For Each doc In Word.Documents
doc.Select

For Each myRange In ActiveDocument.StoryRanges
Selection.Find.ClearFormatting
With Selection.Find
.Text = strFind
.Replacement.Text = strReplace
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next myRange
Next
End Sub

Save and exit the macro editor.

Run the macro in Word (Tools > Macro > Macros).

Note that this macro is quick and dirty. It only replaces in the main text.


 

Tom in London
United Kingdom
Local time: 02:38
Member (2008)
Italian to English
TOPIC STARTER
Thanks but.... Jun 1, 2015

...looks complicated !

 

2nl (X)  Identity Verified
Netherlands
Local time: 03:38
Yes, but it IS simple Jun 1, 2015

Tom in London wrote:

...looks complicated !


Perhaps it looks complicated, but it actually is very simple. A couple of clicks only. Don't be afraid. Why not give it a try?


 

Tom in London
United Kingdom
Local time: 02:38
Member (2008)
Italian to English
TOPIC STARTER
Thanks Jun 1, 2015

2nl wrote:

Tom in London wrote:

...looks complicated !


Perhaps it looks complicated, but it actually is very simple. A couple of clicks only. Don't be afraid. Why not give it a try?


OK and thanks- I'll give it a try when I get a free moment


 

Alexander Chisholm  Identity Verified
Italian to English
+ ...
Hi Tom Jun 2, 2015

Let me know how you get on. I use Office 2011 and it would be useful to know. Back in my PC days, I had a concordance search/replace app which was very simple to use and anything that could do similar on a Mac would be a boon.

 

2nl (X)  Identity Verified
Netherlands
Local time: 03:38
There's nothing that you can ruin Jun 2, 2015

Alexander Chisholm wrote:

Let me know how you get on. I use Office 2011 and it would be useful to know. Back in my PC days, I had a concordance search/replace app which was very simple to use and anything that could do similar on a Mac would be a boon.


There's nothing that you can ruin by installing a simple macro in Word. You can find more info here:

http://tinyurl.com/q8ycrg4

This link will open a PDF from Microsoft.

However, the route shown in the video is simpler.


 

Tom in London
United Kingdom
Local time: 02:38
Member (2008)
Italian to English
TOPIC STARTER
I know but Jun 2, 2015

2nl wrote:

There's nothing that you can ruin by installing a simple macro in Word.


I know, but for now I'm happy with Word 2008, which still runs fine in Yosemite and in fact crashes LESS frequently than Word 2011.

But I'll have a go with the macro when I feel like playing around. In the meantime you could dress it up in a fancy GUI, give it an amusing name, and start selling it! You'd be rich! Everybody wants a macro like this ! I only want 49% !

icon_smile.gif

[Edited at 2015-06-02 09:55 GMT]


 

Meta Arkadia
Local time: 08:38
English to Indonesian
+ ...
The easy way... Jun 2, 2015

... for files in one or more known location(s), both open and err, not open.

  • Run TextWrangler (download it here, it doesn't cost any money, and you'll need it anyway at some point)
  • In the menu, go to Search | Multiple-File Search..., select the location, and enter the terms

    TextWrangler%20SR.png

  • In the pop-up screen, select if you only want to save the changes in the open files or not

    TW%20confirm.png

    That's it. The advantage is, that it works for all document file formats, not only *.docx. The disadvantage as compared to
    2nl's macro, is that it requires running an extra app, TextWrangler.

    There are several other ways to do it (Terminal commands, for example), but the macro and the TextWrangler ways seem to me the easiest.

    Cheers,

    Hans

     

  • Tom in London
    United Kingdom
    Local time: 02:38
    Member (2008)
    Italian to English
    TOPIC STARTER
    Doesn't work for me Jun 2, 2015

    Hans - I've tried TExt Wranger and it doesn't work for me. Not only is a simple 2-word phrase not found/ not replaced but the open Word files in which the 2-word phrase occurs are transformed into OpenXML files and can no longer be opened ! What am I doing wrong?

     

    Meta Arkadia
    Local time: 08:38
    English to Indonesian
    + ...
    It does here Jun 2, 2015

    simple 2-word phrase not found/ not replaced

    It does work, but to see the change you'll have to go to the saved file. I think this workflow wasn't intended for open documents, but it works anyway. I wonder how 2nl's macro works (I don't use VBA, too Microsoft for me).
    transformed into OpenXML files and can no longer be opened

    That's because the text part of the *.docx file is XML. If you're curious, just change the extension into *.zip, and unzip. You'll see a file called something like [Content_Types].xml.
    I'm sure you can open the *.docx file after the S/R.

    Cheers,

    Hans


     

    Meta Arkadia
    Local time: 08:38
    English to Indonesian
    + ...
    Not happy Jun 2, 2015

    I claimed the TextWrangler approach worked, and it does. But unlike I'm overlooking something, something will go wrong if you make a change in the frontmost document other than an S&R. If you save that document, you'll "undo" the S&R actions. I think.

    On the other hand, why would all the other documents be open? Probably to allow for S&R... And the procedure mentioned above is perfect for non-open (closed? sounds strange to me) documents, or for open documents and open and non-open documents that only need S&R.

    Cheers,

    Hans


     

    2nl (X)  Identity Verified
    Netherlands
    Local time: 03:38
    Better use CafeTran Jun 2, 2015

    Tom in London wrote:

    But I'll have a go with the macro when I feel like playing around. In the meantime you could dress it up in a fancy GUI


    You'd better give CafeTran a try. It can Find and Replace 2000 instances of a word in 30000 segments in 1000 files in 2 seconds. And it adjusts case automatically. But indeed, it doesn't have a Word interface.

    Next week I'll schedule a training in The Draft House Tower Bridge. Perhaps you want to attend?


     


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


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

    Find/replace in all open documents

    Advanced search






    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 »
    memoQ translator pro
    Kilgray's memoQ is the world's fastest developing integrated localization & translation environment rendering you more productive and efficient.

    With our advanced file filters, unlimited language and advanced file support, memoQ translator pro has been designed for translators and reviewers who work on their own, with other translators or in team-based translation projects.

    More info »



    Forums
    • All of ProZ.com
    • Term search
    • Jobs
    • Forums
    • Multiple search