Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 30 Jun 2008 03:30:00 -0700,    group: microsoft.public.word.vba.addins        back       


"Find and Replace" in multiple open documents in word 2007   
Is there any free addin or program which could "find and replace" a word/text 
string etc. in multiple open documents in word 2007 or could allow us to 
select multiple files in a folder or different folders to do "find and 
replace"?

There are a lot of free as well as wonderful addins/addons of excel with 
plenty of features but hardly any notable/worthy for word. I am unable to 
understand why is it so?
date: Mon, 30 Jun 2008 03:30:00 -0700   author:   shabutt

Re: "Find and Replace" in multiple open documents in word 2007   
I do not have 2007, and refuse to use it.  So I do not know if you can still
do the same with it.  But...you can loop through the Documents collection,
and action each one.  Something like:

Dim aDoc As Document
Dim r As Range

For Each aDoc in Application.Documents
    Set r = aDoc.Range
    With r.Find
        .Text = "yadda"
        .Replacement.Text = "whatever"
        .Execute Replace:=wdReplaceAll
   End With
Next

will replace all "yadda", in all open documents, with "whatever".  There is
no need to either select each document, or even make them active.  The Range
object - set for each document - takes care of it.


shabutt wrote:
>Is there any free addin or program which could "find and replace" a word/text 
>string etc. in multiple open documents in word 2007 or could allow us to 
>select multiple files in a folder or different folders to do "find and 
>replace"?
>
>There are a lot of free as well as wonderful addins/addons of excel with 
>plenty of features but hardly any notable/worthy for word. I am unable to 
>understand why is it so?

-- 
Message posted via http://www.officekb.com
date: Mon, 30 Jun 2008 20:12:44 GMT   author:   fumei via OfficeKB.com u37563@uwe

Re: "Find and Replace" in multiple open documents in word 2007   
As to the questions re: Excel vs Word in the addin department.  Take a look
at the relative number of Excel people to Word people.  In some forums the
Excel thread count outnumbers Word thread count 10-1.

E.g.  on one forum:

Excel threads:  11,633
Word threads:   2,057

And...there you go.  When you have that much activity, you get more stuff
happening.  Plus (and I could be wrong) it seems that the Word object model
seems so strange to people that they avoid making robust things like formal
add-ins.  Wee macros, sure.  Even sophisticated macros, but in general I find
the majority of Word users do not grasp the full power of what it can do.

Unlike (and I could be wrong) a lot of Excel users who WANT to make Excel
dance and sing.  And understand that it can.



fumei wrote:
>I do not have 2007, and refuse to use it.  So I do not know if you can still
>do the same with it.  But...you can loop through the Documents collection,
>and action each one.  Something like:
>
>Dim aDoc As Document
>Dim r As Range
>
>For Each aDoc in Application.Documents
>    Set r = aDoc.Range
>    With r.Find
>        .Text = "yadda"
>        .Replacement.Text = "whatever"
>        .Execute Replace:=wdReplaceAll
>   End With
>Next
>
>will replace all "yadda", in all open documents, with "whatever".  There is
>no need to either select each document, or even make them active.  The Range
>object - set for each document - takes care of it.
>
>>Is there any free addin or program which could "find and replace" a word/text 
>>string etc. in multiple open documents in word 2007 or could allow us to 
>[quoted text clipped - 4 lines]
>>plenty of features but hardly any notable/worthy for word. I am unable to 
>>understand why is it so?

-- 
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200806/1
date: Mon, 30 Jun 2008 20:20:54 GMT   author:   fumei via OfficeKB.com u37563@uwe

Re: "Find and Replace" in multiple open documents in word 2007   
Dear fumei,

Thanks for explaining excel vs word addin development which was quite 
informative but your earlier post left a lot to be desired. I do not have 
much experience with macro code so please forgive my ignorance. 

There are many macros which allow to "find and replace" in multiple files 
but within one folder only. Whatif we need to select multiple files manually 
or multiple files within different folders. Can't a code be changed slightly 
to put this option in the widely used macros avaiable at gmayor.com & 
gregmaxey.mvps.org

Please someone help me out.
date: Mon, 30 Jun 2008 22:44:00 -0700   author:   shabutt

Re: "Find and Replace" in multiple open documents in word 2007   
"fumei via OfficeKB.com" wrote:

> As to the questions re: Excel vs Word in the addin department.  Take a look
> at the relative number of Excel people to Word people.  In some forums the
> Excel thread count outnumbers Word thread count 10-1.
> 
> E.g.  on one forum:
> 
> Excel threads:  11,633
> Word threads:   2,057
> 
> And...there you go.  When you have that much activity, you get more stuff
> happening.  Plus (and I could be wrong) it seems that the Word object model
> seems so strange to people that they avoid making robust things like formal
> add-ins.  Wee macros, sure.  Even sophisticated macros, but in general I find
> the majority of Word users do not grasp the full power of what it can do.
> 
> Unlike (and I could be wrong) a lot of Excel users who WANT to make Excel
> dance and sing.  And understand that it can.
> 

And, to add one more reason, because Excel handles the relationship between 
VBA code and their container differently than Word does, often times, the 
best way of creating/distributing code with Excel is to create an actual 
Add-in as opposed to a template. In fact, there is a workbook format called 
"*.xla" (Microsoft Excel Add-In), which Word does not offer.
date: Wed, 2 Jul 2008 09:15:01 -0700   author:   Jean-Guy Marcil

Re: "Find and Replace" in multiple open documents in word 2007   
"shabutt" wrote:

> Dear fumei,
> 
> Thanks for explaining excel vs word addin development which was quite 
> informative but your earlier post left a lot to be desired. I do not have 

That is a bit harsh... The code posted does exactly what was asked...

> much experience with macro code so please forgive my ignorance. 
> 
> There are many macros which allow to "find and replace" in multiple files 
> but within one folder only. Whatif we need to select multiple files manually 
> or multiple files within different folders. Can't a code be changed slightly 

No, not "slightly", especially since you seem to be implying that only some 
documents in many folders need to be selected.

> to put this option in the widely used macros avaiable at gmayor.com & 
> gregmaxey.mvps.org

The code fumei posted does exactly what you asked for in your original post, 
i.e. Find/Replace in currently opened documents.

For documents in a specified folder, see this page for the code:
   http://word.mvps.org/faqs/macrosvba/BatchFR.htm

Just create a temporary folder and put all the target documents in that 
folder.
If you prefer to leave the documetns in their original folders, and need to 
select just some of the documents in those different folder, then the easiest 
is to open those documents first, and then use the code already posted in 
this thread.
date: Wed, 2 Jul 2008 09:25:02 -0700   author:   Jean-Guy Marcil

Re: "Find and Replace" in multiple open documents in word 2007   
Dear Mr. Jean-Guy Marcil,

>>>That is a bit harsh... The code posted does exactly what was asked...<<<

I am sorry for the comment in response to dear fumei's post. The code is 
alright but due to my lack of vba I was unable to grasp it. I was puzzled and 
didn't know what to add to this code to make it work. Silly me. I just needed 
to add a module in my "normal.dotm" macro enabled global template and cut & 
copy the code and giving it a name, i.e.,

Sub FRinallDoc()
Dim aDoc As Document
Dim r As Range

For Each aDoc In Application.Documents
    Set r = aDoc.Range
    With r.Find
        .Text = "yadda"
        .Replacement.Text = "whatever"
        .Execute Replace:=wdReplaceAll
   End With
Next

End Sub

I also agree with your below comments:

>>>Just create a temporary folder and put all the target documents in that 
folder. If you prefer to leave the documetns in their original folders, and 
need to 
select just some of the documents in those different folder, then the easiest 
is to open those documents first, and then use the code already posted in 
this thread.<<<

I particularly like the "BatchReplaceAnywhere" 
[http://www.gmayor.com/batch_replace.htm] macro since it is compatible with 
word 2007. The other good macro or add-in which could also be used with word 
2007 as well is "VBA Find and Replace" 
[http://gregmaxey.mvps.org/VBA_Find_And_Replace.htm]

I am thankful to you as well as fumei for great help and once again sorry, 
dear fumei.
date: Thu, 3 Jul 2008 03:22:00 -0700   author:   shabutt

Re: "Find and Replace" in multiple open documents in word 2007   
"shabutt" wrote:

> 
> I am thankful to you as well as fumei for great help and once again sorry, 

You don't need to be so apologetic!
I was just pointing out that there probably was some misunderstanding 
between the question and the posted answer.

I am glad you sorted it out and have a solution you can use.
date: Thu, 3 Jul 2008 08:24:00 -0700   author:   Jean-Guy Marcil

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us